Liam
c9ec7f5912
All checks were successful
Publish Docker Images / docker (push) Successful in 1m41s
42 lines
1.3 KiB
Docker
42 lines
1.3 KiB
Docker
FROM fascinated/docker-images:node-pnpm-latest AS base
|
|
|
|
# The web Dockerfile is copy-pasted into our main docs at /docs/handbook/deploying-with-docker.
|
|
# Make sure you update this Dockerfile, the Dockerfile in the web workspace and copy that over to Dockerfile in the docs.
|
|
|
|
FROM base AS builder
|
|
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
|
RUN apk add --no-cache libc6-compat
|
|
RUN apk update
|
|
# Set working directory
|
|
WORKDIR /app
|
|
RUN pnpm install -g turbo
|
|
COPY . .
|
|
RUN turbo prune node --docker
|
|
|
|
# Add lockfile and package.json's of isolated subworkspace
|
|
FROM base AS installer
|
|
RUN apk add --no-cache libc6-compat
|
|
RUN apk update
|
|
WORKDIR /app
|
|
|
|
# First install dependencies (as they change less often)
|
|
COPY --from=builder /app/out/json/ .
|
|
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
|
|
RUN pnpm install
|
|
|
|
# Build the project and its dependencies
|
|
COPY --from=builder /app/out/full/ .
|
|
COPY turbo.json turbo.json
|
|
|
|
RUN pnpm run build --filter=node...
|
|
|
|
FROM base AS runner
|
|
WORKDIR /app
|
|
|
|
# Don't run production as root
|
|
RUN addgroup --system --gid 1001 expressjs
|
|
RUN adduser --system --uid 1001 expressjs
|
|
USER expressjs
|
|
COPY --from=installer /app .
|
|
|
|
CMD node apps/node/dist/index.js |