Spotter-VM/crisiscleanup/lxcfile

60 lines
1.7 KiB
Plaintext
Raw Normal View History

2018-09-12 19:04:55 +02:00
IMAGE crisiscleanup
2018-09-12 16:16:38 +02:00
LAYER shared/alpine
LAYER shared/ruby
LAYER shared/nodejs
LAYER shared/libxml
2018-09-12 19:04:55 +02:00
LAYER crisiscleanup/crisiscleanup
2018-09-12 16:16:38 +02:00
2018-09-12 19:04:55 +02:00
FIXLAYER /usr/bin/fix-apk
2018-09-12 16:16:38 +02:00
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
2018-09-12 19:42:12 +02:00
git clone --depth 50 https://github.com/CrisisCleanup/crisiscleanup /srv/crisiscleanup
# TODO: Update ruby version
git -C /srv/crisiscleanup checkout b9035bd44fff371ea3d525eb560ff45504acaee7
2018-09-12 16:16:38 +02:00
# 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
2018-09-14 18:13:11 +02:00
MOUNT DIR /srv/crisiscleanup/conf srv/crisiscleanup/config
2018-09-12 16:16:38 +02:00
USER 8005 8005
WORKDIR /srv/crisiscleanup
CMD rails server
HALT SIGTERM