This repository has been archived on 2024-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
wikipedia-game-solver/apps/api/Dockerfile
Théo LUDWIG 4e707008f8
All checks were successful
Chromatic / chromatic (push) Successful in 1m55s
CI / ci (push) Successful in 4m33s
CI / commitlint (push) Successful in 15s
chore(api): improve DX (Developer Experience)
2024-08-19 22:11:33 +01:00

31 lines
974 B
Docker

FROM node:22.4.1-slim AS node-pnpm
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /usr/src/app
FROM node-pnpm AS builder
RUN pnpm install --global turbo@2.0.14
COPY ./ ./
RUN turbo prune @repo/api --docker
FROM node-pnpm AS installer
COPY .gitignore .gitignore
COPY --from=builder /usr/src/app/out/json/ ./
COPY --from=builder /usr/src/app/out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --prod
COPY --from=builder /usr/src/app/out/full/ ./
COPY turbo.json turbo.json
# RUN pnpm --filter=@repo/api... exec turbo run build
FROM node-pnpm AS runner
ENV NODE_ENV=production
ENV HOST=0.0.0.0
RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 applicationrunner
USER applicationrunner
COPY --from=installer --chown=applicationrunner:nodejs /usr/src/app ./
WORKDIR /usr/src/app/apps/api
RUN node --run tuyau
CMD ["node", "--import=tsx", "./bin/server.ts"]