2018-03-16 17:30:11 +01:00
|
|
|
FROM ruby
|
2018-09-03 22:12:08 +02:00
|
|
|
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
|
2018-07-09 16:21:48 +02:00
|
|
|
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
|
|
|
|
|
2018-03-16 17:30:11 +01:00
|
|
|
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 \
|
2018-07-09 21:58:44 +02:00
|
|
|
# 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 \
|
2018-07-09 21:58:44 +02:00
|
|
|
&& 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
|
2018-01-29 16:47:27 +01:00
|
|
|
&& 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 \
|
2018-01-24 16:28:41 +01:00
|
|
|
&& 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"]
|
2018-03-25 22:59:42 +02:00
|
|
|
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"]
|