Skip to content

Instantly share code, notes, and snippets.

@iGhost
Created April 15, 2020 19:45
Show Gist options
  • Save iGhost/97b6f43b956d378d6d2cd6c41ab49c84 to your computer and use it in GitHub Desktop.
Save iGhost/97b6f43b956d378d6d2cd6c41ab49c84 to your computer and use it in GitHub Desktop.
# Dockerfile - Development environment
# Alpine linux tiny image
FROM ruby:2.7-alpine
MAINTAINER Ghost
ENV INSTALL_PATH /opt/app
RUN mkdir -p $INSTALL_PATH
#nokogiri requirements
RUN apk add --no-cache --update \
build-base \
libxml2-dev \
libxslt-dev \
postgresql-dev
RUN bundle config build.nokogiri --use-system-libraries
RUN apk add --update --no-cache nodejs yarn ruby-nokogiri
RUN gem install bundler
COPY drkiq/Gemfile Gemfile
WORKDIR /opt/app/drkiq
RUN bundle install --jobs `expr $(cat /proc/cpuinfo | grep -c "cpu cores") - 1` --retry 3 --no-document
USER $USER_ID
VOLUME ["$INSTALL_PATH/public"]
CMD bundle exec unicorn -c config/unicorn.rb
#CMD bundle exec puma -C config/puma.rb
# Dockerfile - Development environment
# Buster big image (~850 Mb)
FROM ruby:2.7.1
MAINTAINER Ghost
ENV INSTALL_PATH /opt/app
RUN mkdir -p $INSTALL_PATH
# nodejs
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg -o /root/yarn-pubkey.gpg && apt-key add /root/yarn-pubkey.gpg
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install -y --no-install-recommends nodejs yarn
# rails
RUN gem install rails bundler
COPY drkiq/Gemfile Gemfile
WORKDIR /opt/app/drkiq
RUN bundle install
USER $USER_ID
VOLUME ["$INSTALL_PATH/public"]
CMD bundle exec unicorn -c config/unicorn.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment