Last active
March 21, 2024 14:40
-
-
Save jonstacks/404a5b883bd97c592bad9ec82057d812 to your computer and use it in GitHub Desktop.
Ember multi-stage docker image example
This file contains hidden or 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
FROM node:8.16.2-jessie as production | |
RUN mkdir -p /usr/src/app | |
WORKDIR /usr/src/app | |
# Add npm binaries to path | |
ENV PATH node_modules/.bin:$PATH | |
# Install yarn | |
RUN curl --compressed -o- -sSL https://yarnpkg.com/install.sh | bash | |
COPY package.json yarn.lock /usr/src/app/ | |
RUN yarn install | |
# Setup frontend deps | |
RUN yarn global add bower | |
COPY bower.json /usr/src/app/ | |
COPY .bowerrc /usr/src/app/ | |
RUN bower --allow-root install | |
COPY . /usr/src/app | |
RUN yarn build | |
ENTRYPOINT ["./docker-entrypoint.sh"] | |
# For deploying to something like s3/cloudfront | |
CMD ["deploy"] | |
# Here we are using a multi-stage build pattern. This allows us to keep the production image | |
# nice and small, while also being able to build a testing image which has google chrome and | |
# other testing tools installed. To build just the production image, run: | |
# docker build --target production -t my-image . | |
FROM production | |
# Install Google Chrome (testing). | |
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - | |
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' | |
RUN apt-get update && apt-get install -y google-chrome-stable | |
# Install a test reporter. In this case, code climate. | |
RUN wget -O /usr/local/bin/cc-test-reporter https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 && \ | |
chmod +x /usr/local/bin/cc-test-reporter | |
ENTRYPOINT ["./docker-entrypoint.sh"] | |
CMD ["coverage"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment