Last active
June 15, 2022 10:18
-
-
Save hypeJunction/ac2d06fe23f1f067fa4276d55be3bd8c to your computer and use it in GitHub Desktop.
Dockerfile for monorepo
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:16-alpine as server-builder | |
WORKDIR /app | |
COPY . . | |
RUN --mount=type=cache,target=/app/.yarn/cache \ | |
npx turbo prune --scope=@me/application-a && \ | |
cp -R .yarn .yarnrc.yml tsconfig.json out/ && \ | |
cd out && \ | |
yarn install && \ | |
yarn turbo run build --filter=@me/application-a && \ | |
yarn workspaces focus --all --production && \ | |
rm -rf node_modules/.cache .yarn/cache applications/application-a/.next/cache | |
FROM node:16-alpine as app | |
ENV NODE_ENV=production | |
WORKDIR /app | |
COPY --chown=node:node --from=server-builder /app/out . | |
WORKDIR /app/applications/web-server | |
USER 1000 | |
CMD ["yarn", "start"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment