refactor(docker): drop deps stage and remove .env from image
Some checks failed
homelab-k8s-services/tcb_devportal/pipeline/head There was a failure building this commit
Some checks failed
homelab-k8s-services/tcb_devportal/pipeline/head There was a failure building this commit
deps stage cache doesn't survive DinD CI restarts — merged into builder. .env removed from image; runtime env injected via K8s deployment.
This commit is contained in:
22
Dockerfile
22
Dockerfile
@@ -1,27 +1,16 @@
|
||||
FROM node:24.0.1-alpine AS deps
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk add --no-cache libc6-compat
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm install --legacy-peer-deps
|
||||
|
||||
|
||||
FROM node:24.0.1-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
RUN apk add --no-cache libc6-compat
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm install --legacy-peer-deps
|
||||
|
||||
# Copy source + .env vào build context
|
||||
COPY . .
|
||||
|
||||
# Đảm bảo .env có trong builder stage
|
||||
COPY .env .env
|
||||
|
||||
RUN npm run build
|
||||
|
||||
|
||||
@@ -39,9 +28,6 @@ COPY --from=builder /app/public ./public
|
||||
COPY --from=builder --chown=1001:1001 /app/.next/standalone ./
|
||||
COPY --from=builder --chown=1001:1001 /app/.next/static ./.next/static
|
||||
|
||||
# Copy .env vào runtime để next.config rewrites đọc được khi server start
|
||||
COPY --from=builder /app/.env ./.env
|
||||
|
||||
USER 1001
|
||||
|
||||
ENV PORT=3000
|
||||
|
||||
Reference in New Issue
Block a user