Skip to content

Instantly share code, notes, and snippets.

@iftheshoefritz
Created July 24, 2019 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iftheshoefritz/93d47278e69f3cafccc8a37915d139c1 to your computer and use it in GitHub Desktop.
Save iftheshoefritz/93d47278e69f3cafccc8a37915d139c1 to your computer and use it in GitHub Desktop.
FROM ruby:2.5.5-alpine as base
# Configure the main working directory. This is the base
# directory used in any further RUN, COPY, and ENTRYPOINT
# commands.
WORKDIR /app
RUN apk update && apk add --no-cache --virtual .run-deps \
bash \
python \
py-pip \
tzdata \
supervisor \
postgresql-client \
postgresql-dev \
nodejs-current \
yarn \
gmp-dev \
curl \
build-base
# Cache this, so that it does not have to change all the time
RUN gem install nokogiri -v 1.10.3
# Copy the Gemfile as well as the Gemfile.lock and install
# the RubyGems. This is a separate step so the dependencies
# will be cached unless changes to one of those two files
# are made.
ARG GEMS_USERNAME
ARG GEMS_PASSWORD
COPY Gemfile Gemfile.lock ./
RUN bundle config gems.pdg.io ${GEMS_USERNAME}:${GEMS_PASSWORD}
RUN gem install bundler --version 1.17.3
RUN bundle install --without development test --jobs=2 --retry 5
FROM base as production
# Need AWS cli in set_env_vars
RUN apk add --no-cache --virtual .py-build-deps python-dev \
&& pip install --no-cache-dir awscli \
&& apk del .py-build-deps
# Copy the main application.
COPY . ./
# Copy swagger.yaml into public/
RUN cp swagger/v1/swagger.yaml public/school/swagger/v1/swagger.yaml
# Will run on port 3000 by default
EXPOSE 3000
CMD ["/usr/bin/supervisord"]
FROM base as test
RUN apk add \
nodejs-npm \
cmake \
cmake-doc
RUN bundle install --with test --jobs=2 --retry 5
RUN gem install brakeman
COPY . ./
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment