Created
August 6, 2019 19:07
-
-
Save sibelius/8ae1edd6603658da5f9e6dcf63465aa7 to your computer and use it in GitHub Desktop.
Dockerfile monorepo
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
### **** This is the Build Image **** | |
FROM node:10.15.3 | |
# Create app directory | |
RUN mkdir -p /usr/src/app | |
WORKDIR /usr/src/app | |
# Followed this repo: | |
# https://github.com/slanatech/vue-monorepo-boilerplate/blob/ef3d5d2bcdf47c553a2713eca222c22ea1bc2901/README.md#docker-build | |
# to setup Docker + Lerna monorepo approach | |
# Copy monorepo setup files | |
COPY package.json yarn.lock lerna.json /usr/src/app/ | |
# Copy packages used by dependencies | |
COPY ./packages/babel/package.json /usr/src/app/packages/babel/package.json | |
COPY ./packages/api/package.json /usr/src/app/packages/api/package.json | |
COPY ./packages/common/package.json /usr/src/app/packages/common/package.json | |
RUN yarn install --frozen-lockfile | |
# Bundle app source | |
COPY . /usr/src/app | |
RUN yarn workspace @entria/api build | |
RUN yarn workspace @entria/common build | |
EXPOSE ${SERVER_PORT} |
we can go even further
https://hackernoon.com/circleci-performance-difference-between-cache-and-workspace-5567679c3601
- yarn autoclean
- node-prune
- use webpack tree shaking to build server
Or use zeit ncc to build server
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think something like that is better because you will make a smaller image with multi-stage
you can use that as well