Skip to content

Instantly share code, notes, and snippets.

@EvgenyKungurov
Created July 21, 2020 03:47
Show Gist options
  • Save EvgenyKungurov/6890dcb61ef3aaf33ce2d342f42144e3 to your computer and use it in GitHub Desktop.
Save EvgenyKungurov/6890dcb61ef3aaf33ce2d342f42144e3 to your computer and use it in GitHub Desktop.
FROM ruby:2.6.5-alpine3.10
ENV WEB_PORT 80
ENV BUILD_PACKAGES nginx nodejs tzdata postgresql-dev alpine-sdk yarn imagemagick
ENV UPDATE_PACKAGES libxml2 libxslt sqlite bash
WORKDIR /app
ENV HOME /app
RUN set -ex && \
apk --update add --no-cache $BUILD_PACKAGES && \
apk add --no-cache -u $UPDATE_PACKAGES && \
ln -sf /dev/stdout /var/log/nginx/access.log && \
ln -sf /dev/stderr /var/log/nginx/error.log && \
rm -rf /var/cache/apk/* && \
:
COPY Gemfile Gemfile.lock ./
RUN set -ex && \
bundle install --clean --no-cache --deployment --without development && \
# Remove unneeded files (apk cache, cached *.gem, *.o, *.c)
rm -rf vendor/bundle/ruby/*/cache && \
find vendor/bundle/ -name "*.c" -delete && \
find vendor/bundle/ -name "*.o" -delete && \
rm -rf /var/cache/apk/* && \
:
COPY config/nginx.conf /etc/nginx/nginx.conf
RUN nginx -t -c /etc/nginx/nginx.conf
COPY . .
RUN set -ex && \
yarn install && \
SECRET_KEY_BASE=12id83maj10mjmahyabv978ba7lldlmernkandji83jnmanoqppaajey NODE_ENV=development RAILS_ENV=production bundle exec rake assets:precompile && \
yarn cache clean && \
rm -rf /usr/lib/node_modules node_modules/.cache tmp/cache lib/assets && \
:
RUN set -ex && \
chown -R nginx:nginx /app && \
nginx -t && \
:
EXPOSE $WEB_PORT
CMD ["./bin/docker-entrypoint.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment