Skip to content

Instantly share code, notes, and snippets.

@wshihadeh
Last active October 20, 2019 17:16
Show Gist options
  • Save wshihadeh/322d5867990cf9b6aaaf0e7ee5d2f153 to your computer and use it in GitHub Desktop.
Save wshihadeh/322d5867990cf9b6aaaf0e7ee5d2f153 to your computer and use it in GitHub Desktop.
Rails docker base image file
FROM ruby:2.6.4-alpine
MAINTAINER Al-waleed Shihadeh <[email protected]>
ENV PORT 8080
ENV RACK_ENV=production RAILS_ENV=production
ENV RAILS_LOG_TO_STDOUT=true
ENV SECRET_KEY_BASE changeme
EXPOSE 8080
RUN addgroup -g 1000 rails && \
adduser -S -G rails -u 1000 -h /application rails && \
chown -R rails /usr/local/bundle && \
apk update && \
apk add linux-headers build-base curl zlib-dev libxml2-dev libxslt-dev tzdata yaml-dev git nodejs file zip unzip && \
rm -rf /var/cache/apk/*
USER rails
RUN gem install bundler && \
bundle config build.nokogiri --use-system-libraries && \
rm -rf /usr/lib/lib/ruby/gems/*/cache/*
USER root
ONBUILD ADD . /application
ONBUILD RUN chown -R rails /application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment