Spotter-VM/crisiscleanup/Dockerfile

49 lines
1.6 KiB
Docker
Raw Normal View History

FROM ruby
LABEL maintainer="Disassembler <disassembler@dasm.cz>"
2017-12-25 11:43:06 +01:00
2018-01-08 21:04:35 +01:00
RUN \
# Install NodeJS runtime
apk --no-cache add nodejs
2018-01-08 21:04:35 +01:00
2017-12-25 11:43:06 +01:00
RUN \
# Install runtime dependencies
2018-01-08 21:04:35 +01:00
apk --no-cache add libpq libxml2 libxslt tzdata
ENV RAILS_ENV production
2018-01-08 21:04:35 +01:00
RUN \
2017-12-25 11:43:06 +01:00
# Install build dependencies
2018-07-09 19:44:58 +02:00
apk --no-cache add --virtual .deps build-base git libxml2-dev libxslt-dev linux-headers npm postgresql-dev yarn zlib-dev \
2017-12-25 11:43:06 +01:00
# Clone CrisisCleanup
2018-04-21 22:30:25 +02:00
&& git clone --depth 1 https://github.com/CrisisCleanup/crisiscleanup /srv/crisiscleanup \
# Hackfix ruby and nodejs dependency versions
2018-04-21 22:30:25 +02:00
&& 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 \
2017-12-25 11:43:06 +01:00
# Install Ruby and NodeJS dependencies
2018-04-21 22:30:25 +02:00
&& cd /srv/crisiscleanup \
2017-12-25 11:43:06 +01:00
&& bundle config build.nokogiri --use-system-libraries \
&& bundle install \
&& npm install \
&& yarn \
# Create CrisisCleanup secret
2018-04-21 22:30:25 +02:00
&& echo -e "production:\n secret_key_base: $(rake secret)" >/srv/crisiscleanup/config/secrets.yml \
2017-12-25 11:43:06 +01:00
# Generate static resources
&& rake assets:precompile \
# Create OS user
2018-04-21 22:30:25 +02:00
&& 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 \
2017-12-25 11:43:06 +01:00
# Cleanup
&& apk --no-cache del .deps \
2018-04-21 22:30:25 +02:00
&& find /srv/crisiscleanup -name '.git*' -exec rm -rf {} + \
2017-12-25 11:43:06 +01:00
&& rm -rf /usr/local/share/.cache \
&& rm -rf /root/.bundle /root/.config /root/.npm
2017-12-25 11:43:06 +01:00
2018-04-21 22:30:25 +02:00
VOLUME ["/srv/crisiscleanup/config"]
EXPOSE 8080
2017-12-25 11:43:06 +01:00
2018-04-21 22:30:25 +02:00
USER cc
WORKDIR /srv/crisiscleanup
2017-12-25 11:43:06 +01:00
CMD ["rails", "server"]