2020-04-04 00:17:24 +02:00
|
|
|
IMAGE crisiscleanup_2.2.0-200403
|
|
|
|
FROM alpine3.8-ruby2.4_2.4.9-200403
|
2020-03-22 12:38:38 +01:00
|
|
|
# yarn dependencies installation fails on nodejs>8
|
2018-09-12 16:16:38 +02:00
|
|
|
|
|
|
|
ENV RAILS_ENV production
|
|
|
|
|
|
|
|
RUN EOF
|
|
|
|
# Install runtime dependencies
|
2019-11-30 09:59:32 +01:00
|
|
|
apk --no-cache add libpq nodejs tzdata
|
2018-09-12 16:16:38 +02:00
|
|
|
|
|
|
|
# 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
|
2020-04-04 17:33:04 +02:00
|
|
|
git clone https://github.com/CrisisCleanup/crisiscleanup-2 /srv/crisiscleanup
|
|
|
|
git -C /srv/crisiscleanup checkout e362761e67e835d46c36073de1f95803737d1d29
|
2018-12-05 14:07:45 +01:00
|
|
|
|
2019-02-26 20:24:02 +01:00
|
|
|
# Hackfix ruby dependency versions
|
2020-03-16 19:21:08 +01:00
|
|
|
sed -i 's/ruby "2\.4\.4"/ruby "2.4.9"/' /srv/crisiscleanup/Gemfile
|
2019-12-21 14:26:47 +01:00
|
|
|
gem install bundler:1.16.6
|
2018-09-12 16:16:38 +02:00
|
|
|
|
|
|
|
# Install Ruby and NodeJS dependencies
|
|
|
|
cd /srv/crisiscleanup
|
|
|
|
bundle config build.nokogiri --use-system-libraries
|
|
|
|
bundle install
|
|
|
|
npm install
|
|
|
|
yarn
|
|
|
|
|
2020-03-16 20:53:27 +01:00
|
|
|
# Create dummy CrisisCleanup secret
|
2018-09-12 16:16:38 +02:00
|
|
|
echo -e "production:\n secret_key_base: $(rake secret)" >/srv/crisiscleanup/config/secrets.yml
|
|
|
|
|
|
|
|
# Generate static resources
|
|
|
|
rake assets:precompile
|
|
|
|
|
|
|
|
# Create OS user
|
2019-10-14 07:59:06 +02:00
|
|
|
addgroup -S -g 8080 cc
|
|
|
|
adduser -S -u 8080 -h /srv/crisiscleanup -s /bin/false -g cc -G cc cc
|
2018-09-12 16:16:38 +02:00
|
|
|
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
|
2020-03-25 21:32:19 +01:00
|
|
|
rm -rf /.bundle /root/.config /root/.npm
|
2018-09-12 16:16:38 +02:00
|
|
|
EOF
|
|
|
|
|
2020-03-16 19:21:08 +01:00
|
|
|
USER cc
|
2018-09-12 16:16:38 +02:00
|
|
|
WORKDIR /srv/crisiscleanup
|
2020-03-16 19:21:08 +01:00
|
|
|
CMD /usr/local/bin/rails server
|
2018-09-18 16:27:42 +02:00
|
|
|
HALT SIGTERM
|