update
This commit is contained in:
+29
-60
@@ -1,79 +1,48 @@
|
||||
FROM node:23-slim AS builder
|
||||
FROM node:22-slim AS deps
|
||||
|
||||
WORKDIR /app
|
||||
# Set DEBIAN_FRONTEND to noninteractive to avoid prompts during apt-get operations
|
||||
# ENV DEBIAN_FRONTEND=noninteractive
|
||||
ARG NPM_REGISTRY=https://registry.npmjs.org/
|
||||
ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY}
|
||||
ENV npm_config_registry=${NPM_REGISTRY}
|
||||
|
||||
# Copy your custom sources.list file into the container
|
||||
# COPY custom-sources.list /etc/apt/sources.list
|
||||
|
||||
# RUN release=$(grep VERSION_CODENAME= /etc/os-release | cut -d= -f2) && \
|
||||
# echo "deb http://mirror.arvancloud.ir/debian Bookworm main contrib non-free non-free-firmware" > /etc/apt/sources.list && \
|
||||
# echo "deb http://mirror.arvancloud.ir/debian-security Bookworm-security main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \
|
||||
# echo "deb http://mirror.arvancloud.ir/debian Bookworm-updates main contrib non-free non-free-firmware" >> /etc/apt/sources.list
|
||||
|
||||
|
||||
# RUN apt-get update --allow-unauthenticated && apt-get install -y --no-install-recommends ca-certificates && update-ca-certificates
|
||||
|
||||
# RUN apt-get update -y && apt-get install -y openssl
|
||||
|
||||
RUN npm config set registry https://hub.megan.ir/npm
|
||||
RUN npm install -g pnpm
|
||||
|
||||
|
||||
# ARG NODE_ENV
|
||||
# ARG PORT
|
||||
# ARG DATABASE_NAME
|
||||
# ARG DATABASE_USER
|
||||
# ARG DATABASE_PASSWORD
|
||||
# ARG DATABASE_PORT
|
||||
# ARG DATABASE_HOST
|
||||
# ARG DATABASE_URL
|
||||
# ARG SHADOW_DATABASE_URL
|
||||
# ARG JWT_SECRET
|
||||
# ARG JWT_EXPIRES_IN
|
||||
# ARG OTP_STATIC_CODE
|
||||
|
||||
|
||||
# ENV NODE_ENV=${NODE_ENV}
|
||||
# ENV PORT=${PORT}
|
||||
# ENV DATABASE_NAME=${DATABASE_NAME}
|
||||
# ENV DATABASE_USER=${DATABASE_USER}
|
||||
# ENV DATABASE_PASSWORD=${DATABASE_PASSWORD}
|
||||
# ENV DATABASE_PORT=${DATABASE_PORT}
|
||||
# ENV DATABASE_HOST=${DATABASE_HOST}
|
||||
# ENV DATABASE_URL=${DATABASE_URL}
|
||||
# ENV SHADOW_DATABASE_URL=${SHADOW_DATABASE_URL}
|
||||
# ENV JWT_SECRET=${JWT_SECRET}
|
||||
# ENV JWT_EXPIRES_IN=${JWT_EXPIRES_IN}
|
||||
# ENV OTP_STATIC_CODE=${OTP_STATIC_CODE}
|
||||
|
||||
COPY pnpm-lock.yaml package.json ./
|
||||
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 prisma generate
|
||||
RUN pnpm run build
|
||||
RUN pnpm run build && pnpm prune --prod
|
||||
|
||||
|
||||
FROM node:23-slim
|
||||
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}
|
||||
|
||||
RUN npm config set registry https://hub.megan.ir/npm
|
||||
RUN npm install -g pnpm
|
||||
ENV NODE_ENV=production
|
||||
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
# RUN pnpm prune --prod
|
||||
|
||||
COPY --from=builder /app/dist ./dist
|
||||
# COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
|
||||
# COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
|
||||
COPY prisma ./prisma
|
||||
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"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user