Files
psp_api/Dockerfile
T
2026-04-22 21:55:40 +03:30

49 lines
1.1 KiB
Docker

FROM node:22-slim AS deps
WORKDIR /app
ARG NPM_REGISTRY=https://registry.npmjs.org/
ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY}
ENV npm_config_registry=${NPM_REGISTRY}
RUN corepack enable
RUN npm config set registry ${NPM_REGISTRY}
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
FROM node:22-slim AS build
WORKDIR /app
ARG NPM_REGISTRY=https://registry.npmjs.org/
ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY}
ENV npm_config_registry=${NPM_REGISTRY}
RUN corepack enable
RUN npm config set registry ${NPM_REGISTRY}
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ENV PRISMA_CLIENT_ENGINE_TYPE=binary
RUN pnpm run build && pnpm prune --prod
FROM node:22-slim AS runtime
WORKDIR /app
ARG NPM_REGISTRY=https://registry.npmjs.org/
ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY}
ENV npm_config_registry=${NPM_REGISTRY}
ENV NODE_ENV=production
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
COPY --from=build /app/prisma ./prisma
COPY --from=build /app/package.json ./package.json
CMD ["node", "dist/src/main.js"]