Created
June 22, 2017 17:06
-
-
Save adilsoncarvalho/cc916de4f217653d472b9b87ae2b6479 to your computer and use it in GitHub Desktop.
Dockerfile: multi-stage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ---- 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