This commit is contained in:
Disassembler 2018-09-12 16:16:38 +02:00
parent d6447bb437
commit c7c949eead
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
12 changed files with 56 additions and 49 deletions

View File

@ -28,6 +28,7 @@ lxc-build ${SOURCE_DIR}/basic-runtimes/tomcat.lxcfile
lxc-build ${SOURCE_DIR}/activemq lxc-build ${SOURCE_DIR}/activemq
lxc-build ${SOURCE_DIR}/ckan lxc-build ${SOURCE_DIR}/ckan
lxc-build ${SOURCE_DIR}/ckan-datapusher lxc-build ${SOURCE_DIR}/ckan-datapusher
lxc-build ${SOURCE_DIR}/crisiscleanup
lxc-build ${SOURCE_DIR}/postgres lxc-build ${SOURCE_DIR}/postgres
lxc-build ${SOURCE_DIR}/redis lxc-build ${SOURCE_DIR}/redis
lxc-build ${SOURCE_DIR}/solr lxc-build ${SOURCE_DIR}/solr

View File

@ -1,48 +0,0 @@
FROM ruby
LABEL maintainer="Disassembler <disassembler@dasm.cz>"
RUN \
# Install NodeJS runtime
apk --no-cache add nodejs
RUN \
# Install runtime dependencies
apk --no-cache add libpq libxml2 libxslt tzdata
ENV RAILS_ENV production
RUN \
# Install build dependencies
apk --no-cache add --virtual .deps build-base git libxml2-dev libxslt-dev linux-headers npm postgresql-dev yarn zlib-dev \
# Clone CrisisCleanup
&& git clone --depth 1 https://github.com/CrisisCleanup/crisiscleanup /srv/crisiscleanup \
# Hackfix ruby and nodejs dependency versions
&& sed -i 's/2\.2\.5/2.3.6/' /srv/crisiscleanup/Gemfile \
&& sed -i 's/rdoc (4\.2\.0)/rdoc (4.3.0)/' /srv/crisiscleanup/Gemfile.lock \
&& sed -i 's/8\.2\.0/>=8.2.0/' /srv/crisiscleanup/package.json \
# Install Ruby and NodeJS dependencies
&& cd /srv/crisiscleanup \
&& bundle config build.nokogiri --use-system-libraries \
&& bundle install \
&& npm install \
&& yarn \
# Create CrisisCleanup secret
&& echo -e "production:\n secret_key_base: $(rake secret)" >/srv/crisiscleanup/config/secrets.yml \
# Generate static resources
&& rake assets:precompile \
# Create OS user
&& addgroup -S -g 8005 cc \
&& adduser -S -u 8005 -h /srv/crisiscleanup -s /bin/false -g cc -G cc cc \
&& chown -R cc:cc /srv/crisiscleanup \
# Cleanup
&& apk --no-cache del .deps \
&& find /srv/crisiscleanup -name '.git*' -exec rm -rf {} + \
&& rm -rf /usr/local/share/.cache \
&& rm -rf /root/.bundle /root/.config /root/.npm
VOLUME ["/srv/crisiscleanup/config"]
EXPOSE 8080
USER cc
WORKDIR /srv/crisiscleanup
CMD ["rails", "server"]

54
crisiscleanup/lxcfile Normal file
View File

@ -0,0 +1,54 @@
LAYER shared/alpine
LAYER shared/ruby
LAYER shared/nodejs
LAYER shared/libxml
LAYERFIX /usr/bin/fix-apk
ENV RAILS_ENV production
RUN EOF
# Install runtime dependencies
apk --no-cache add libpq tzdata
# Install build dependencies
apk --no-cache add --virtual .deps build-base git libxml2-dev libxslt-dev linux-headers npm postgresql-dev yarn zlib-dev
# Clone CrisisCleanup
git clone --depth 1 https://github.com/CrisisCleanup/crisiscleanup /srv/crisiscleanup
# Hackfix ruby and nodejs dependency versions
sed -i 's/2\.2\.5/2.3.6/' /srv/crisiscleanup/Gemfile
sed -i 's/rdoc (4\.2\.0)/rdoc (4.3.0)/' /srv/crisiscleanup/Gemfile.lock
sed -i 's/8\.2\.0/>=8.2.0/' /srv/crisiscleanup/package.json
# Install Ruby and NodeJS dependencies
cd /srv/crisiscleanup
bundle config build.nokogiri --use-system-libraries
bundle install
npm install
yarn
# Create CrisisCleanup secret
echo -e "production:\n secret_key_base: $(rake secret)" >/srv/crisiscleanup/config/secrets.yml
# Generate static resources
rake assets:precompile
# Create OS user
addgroup -S -g 8005 cc
adduser -S -u 8005 -h /srv/crisiscleanup -s /bin/false -g cc -G cc cc
chown -R cc:cc /srv/crisiscleanup
# Cleanup
apk --no-cache del .deps
find /srv/crisiscleanup -name '.git*' -exec rm -rf {} +
rm -rf /usr/local/share/.cache
rm -rf /root/.bundle /root/.config /root/.npm
EOF
VOLUME /srv/crisiscleanup/conf srv/crisiscleanup/config
USER 8005 8005
WORKDIR /srv/crisiscleanup
CMD rails server

0
crisiscleanup/build.sh → crisiscleanup/setup.sh Executable file → Normal file
View File

View File

@ -77,7 +77,7 @@ class LXCImage:
if line == script_eof: if line == script_eof:
script_eof = None script_eof = None
self.run_script(script) self.run_script(script)
elif in_script: else:
script.append(line) script.append(line)
elif line.startswith('RUN'): elif line.startswith('RUN'):
script = [] script = []