update docker file
This commit is contained in:
@@ -1,2 +0,0 @@
|
|||||||
# registry=https://mirror-npm.runflare.com
|
|
||||||
# registry=https://package-mirror.liara.ir/repository/npm/
|
|
||||||
+15
-8
@@ -1,23 +1,31 @@
|
|||||||
# Stage 1: Base
|
# Stage 1: Base
|
||||||
FROM node:22-alpine AS base
|
FROM node:22-alpine AS base
|
||||||
|
|
||||||
|
# Change Alpine repo
|
||||||
|
RUN sed -i 's|https://dl-cdn.alpinelinux.org/alpine|https://mirror.de.velop.ir/alpine|g' /etc/apk/repositories
|
||||||
|
|
||||||
|
# Configure npm registry mirror (Liara)
|
||||||
|
ENV NPM_CONFIG_REGISTRY=https://package-mirror.liara.ir/repository/npm/
|
||||||
|
RUN npm config set registry https://package-mirror.liara.ir/repository/npm/
|
||||||
|
|
||||||
# Timezone (Node 22 respects TZ without needing tzdata installed)
|
# Timezone (Node 22 respects TZ without needing tzdata installed)
|
||||||
ENV TZ=Asia/Tehran
|
ENV TZ=Asia/Tehran
|
||||||
|
|
||||||
# Set workdir for clarity
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Stage 2: Dependencies
|
# Stage 2: Dependencies (single install — reused for build and production)
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
WORKDIR /temp-deps
|
WORKDIR /temp-deps
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm config set registry https://registry.npmjs.org/ && npm ci
|
ENV NODE_OPTIONS=--max-old-space-size=4096
|
||||||
|
RUN npm ci --ignore-scripts
|
||||||
|
|
||||||
# Stage 3: Production dependencies
|
# Stage 3: Production node_modules (prune dev deps instead of a second npm ci)
|
||||||
FROM base AS prod-deps
|
FROM deps AS prod-deps
|
||||||
WORKDIR /temp-prod-deps
|
WORKDIR /temp-prod-deps
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm config set registry https://registry.npmjs.org/ && npm ci --omit=dev --ignore-scripts
|
COPY --from=deps /temp-deps/node_modules ./node_modules
|
||||||
|
RUN npm prune --omit=dev --ignore-scripts
|
||||||
|
|
||||||
# Stage 4: Build
|
# Stage 4: Build
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
@@ -39,5 +47,4 @@ USER appuser
|
|||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
EXPOSE 4000
|
EXPOSE 4000
|
||||||
|
|
||||||
CMD ["npm", "start"]
|
CMD ["node", "--max-old-space-size=2048", "dist/src/main"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user