Skip to content

Instantly share code, notes, and snippets.

@adilsoncarvalho
Created June 22, 2017 17:06
Show Gist options
  • Save adilsoncarvalho/cc916de4f217653d472b9b87ae2b6479 to your computer and use it in GitHub Desktop.
Save adilsoncarvalho/cc916de4f217653d472b9b87ae2b6479 to your computer and use it in GitHub Desktop.
Dockerfile: multi-stage
# ---- Base Node ----
FROM ubuntu AS base
# install the core dependencies
RUN apt-get install -y my package list
# set working directory
WORKDIR /app
# copy project file
COPY Gemfile .
COPY Gemfile.lock
# ---- Dependencies ----
FROM base AS dependencies
# install dependencies
RUN bundle install --without development test
# ---- Test ----
# run linters, setup and tests
FROM dependencies AS test
COPY . .
RUN bundle install --without development && rspec
# ---- Release ----
FROM base AS release
# copy production node_modules
COPY --from=dependencies gems ./gems
# copy app sources
COPY . .
# expose port and define CMD
EXPOSE 5000
CMD ["app", "start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment