You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I have noticed you haven't removed the source code for minimum image size. Here is my Dockerfile, do you think the find command is a good idea? Also, how would you go about removing source after building them to js from package dependencies or app dependencies in "packages" folder or "apps" folder?
FROM node:18-alpine as deps
RUN apk add --no-cache libc6-compat
RUN apk update
RUN npm i -g turbo pnpm
FROM node:18-alpine As base
RUN apk add --no-cache libc6-compat
RUN apk update
RUN npm i -g turbo
WORKDIR /app
COPY . .
RUN turbo prune --scope=api --docker
FROM deps as development
WORKDIR /app
# First install the dependencies (as they change less often)
COPY .gitignore .gitignore
COPY turbo.json turbo.json
COPY --from=base /app/out/json/ .
COPY --from=base /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN pnpm install
# # Build the project
COPY --from=base /app/out/full/ .
CMD ["turbo", "dev"]
FROM deps as builder
WORKDIR /app
COPY --from=development --chown=node:node /app .
RUN pnpm turbo run build --filter=api...
RUN pnpm install --prod
WORKDIR /app/apps/api
RUN find . ! -name dist ! -name node_modules ! -name .env -maxdepth 1 -mindepth 1 -exec rm -rf {} +
FROM node:18-alpine As production
WORKDIR /app
COPY --chown=node:node --from=builder /app .
WORKDIR /app/apps/api
CMD [ "node", "./dist/src/main.js" ]
The text was updated successfully, but these errors were encountered:
Hello. I have noticed you haven't removed the source code for minimum image size. Here is my Dockerfile, do you think the find command is a good idea? Also, how would you go about removing source after building them to js from package dependencies or app dependencies in "packages" folder or "apps" folder?
The text was updated successfully, but these errors were encountered: