Spotter-VM/lxc-apps/crisiscleanup/image

51 lines
1.5 KiB
Plaintext

IMAGE crisiscleanup_2.2.0-201021
FROM alpine3.8-ruby2.4_2.4.10-201021
# yarn dependencies installation fails on nodejs>8
ENV RAILS_ENV production
RUN EOF
# Install runtime dependencies
apk --no-cache add libpq nodejs 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 https://github.com/CrisisCleanup/crisiscleanup-2 /srv/crisiscleanup
git -C /srv/crisiscleanup checkout e362761e67e835d46c36073de1f95803737d1d29
# Hackfix ruby dependency versions
sed -i 's/ruby "2\.4\.4"/ruby "2.4.10"/' /srv/crisiscleanup/Gemfile
gem install bundler:1.16.6
# Install Ruby and NodeJS dependencies
cd /srv/crisiscleanup
bundle config build.nokogiri --use-system-libraries
bundle install
npm install
yarn
# Create dummy 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 8080 cc
adduser -S -u 8080 -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 /.bundle /root/.config /root/.npm
EOF
USER cc
WORKDIR /srv/crisiscleanup
CMD /usr/local/bin/rails server
HALT SIGTERM