Files
psp_api/Dockerfile
T

49 lines
1.1 KiB
Docker
Raw Normal View History

2026-04-22 21:55:40 +03:30
FROM node:22-slim AS deps
WORKDIR /app
2026-04-22 21:55:40 +03:30
ARG NPM_REGISTRY=https://registry.npmjs.org/
ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY}
ENV npm_config_registry=${NPM_REGISTRY}
2026-04-22 21:55:40 +03:30
RUN corepack enable
RUN npm config set registry ${NPM_REGISTRY}
2026-04-22 21:55:40 +03:30
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
2026-03-31 21:26:01 +03:30
2026-04-22 21:55:40 +03:30
FROM node:22-slim AS build
2026-03-31 21:26:01 +03:30
2026-04-22 21:55:40 +03:30
WORKDIR /app
ARG NPM_REGISTRY=https://registry.npmjs.org/
ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY}
ENV npm_config_registry=${NPM_REGISTRY}
2026-03-31 21:26:01 +03:30
2026-04-22 21:55:40 +03:30
RUN corepack enable
RUN npm config set registry ${NPM_REGISTRY}
2026-04-22 21:55:40 +03:30
COPY --from=deps /app/node_modules ./node_modules
COPY . .
2026-03-31 21:26:01 +03:30
ENV PRISMA_CLIENT_ENGINE_TYPE=binary
2026-04-22 21:55:40 +03:30
RUN pnpm run build && pnpm prune --prod
2026-03-31 21:26:01 +03:30
2026-04-22 21:55:40 +03:30
FROM node:22-slim AS runtime
WORKDIR /app
2026-04-22 21:55:40 +03:30
ARG NPM_REGISTRY=https://registry.npmjs.org/
ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY}
ENV npm_config_registry=${NPM_REGISTRY}
2026-04-22 21:55:40 +03:30
ENV NODE_ENV=production
2026-04-22 21:55:40 +03:30
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
2026-03-31 21:26:01 +03:30
CMD ["node", "dist/src/main.js"]