Created
January 3, 2022 18:54
-
-
Save ArveSystad/3670a835058b24a7e9a864feddd939f7 to your computer and use it in GitHub Desktop.
Modified dockerfile for use in this blogpost:
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
# This dockerfile builds an image for the backend package. | |
# It should be executed with the root of the repo as docker context. | |
# | |
# Before building this image, be sure to have run the following commands in the repo root: | |
# | |
# yarn install | |
# yarn tsc | |
# yarn build | |
# | |
# Once the commands have been run, you can build the image using `yarn build-image` | |
FROM node:14-buster-slim | |
WORKDIR /app | |
# Copy repo skeleton first, to avoid unnecessary docker cache invalidation. | |
# The skeleton contains the package.json of each package in the monorepo, | |
# and along with yarn.lock and the root package.json, that's enough to run yarn install. | |
COPY yarn.lock package.json packages/backend/dist/skeleton.tar.gz ./ | |
RUN tar xzf skeleton.tar.gz && rm skeleton.tar.gz | |
RUN yarn install --frozen-lockfile --production --network-timeout 300000 && rm -rf "$(yarn cache dir)" | |
# Then copy the rest of the backend bundle, along with any other files we might want. | |
COPY packages/backend/dist/bundle.tar.gz app-config.yaml app-config.production.yaml ./ | |
RUN tar xzf bundle.tar.gz && rm bundle.tar.gz | |
CMD ["node", "packages/backend", "--config", "app-config.yaml", "--config", "app-config.production.yaml"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment