bugs
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
# Stage 1: Base
|
||||
FROM node:22-alpine AS base
|
||||
|
||||
# Timezone (Node 22 respects TZ without needing tzdata installed)
|
||||
ENV TZ=Asia/Tehran
|
||||
|
||||
# Set workdir for clarity
|
||||
WORKDIR /app
|
||||
|
||||
# Stage 2: Dependencies
|
||||
FROM base AS deps
|
||||
WORKDIR /temp-deps
|
||||
COPY package*.json ./
|
||||
RUN npm config set registry https://registry.npmjs.org/ && npm ci
|
||||
|
||||
# Stage 3: Production dependencies
|
||||
FROM base AS prod-deps
|
||||
WORKDIR /temp-prod-deps
|
||||
COPY package*.json ./
|
||||
RUN npm config set registry https://registry.npmjs.org/ && npm ci --omit=dev --ignore-scripts
|
||||
|
||||
# Stage 4: Build
|
||||
FROM base AS builder
|
||||
WORKDIR /build
|
||||
COPY package*.json ./
|
||||
COPY --from=deps /temp-deps/node_modules ./node_modules
|
||||
COPY . ./
|
||||
RUN npm run build
|
||||
|
||||
# Stage 5: Runner
|
||||
FROM base AS runner
|
||||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder --chown=appuser:appgroup /build/ ./
|
||||
COPY --from=prod-deps --chown=appuser:appgroup /temp-prod-deps/node_modules ./node_modules
|
||||
|
||||
USER appuser
|
||||
ENV NODE_ENV=production
|
||||
EXPOSE 4000
|
||||
|
||||
CMD ["npm", "start"]
|
||||
|
||||
Reference in New Issue
Block a user