Skip to content

Instantly share code, notes, and snippets.

@wshihadeh
Created October 20, 2019 18:17
Show Gist options
  • Select an option

  • Save wshihadeh/050b0f2fb350fd8ef408ebdf6b46087b to your computer and use it in GitHub Desktop.

Select an option

Save wshihadeh/050b0f2fb350fd8ef408ebdf6b46087b to your computer and use it in GitHub Desktop.
Docker base image template
FROM ruby:<%= ruby_version %>-alpine
MAINTAINER Al-waleed Shihadeh <wshihadeh.dev@gmail.com>
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 <%= additional_pkgs.join(" ") %> && \
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