init
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# ---- Stage 1: Dependencies ----
|
||||
FROM node:20-alpine AS deps
|
||||
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm ci
|
||||
|
||||
# ---- Stage 2: Build ----
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
RUN npm run build
|
||||
|
||||
# ---- Stage 3: Production ----
|
||||
FROM node:20-alpine AS production
|
||||
|
||||
RUN apk add --no-cache dumb-init
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
WORKDIR /app
|
||||
|
||||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
||||
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder --chown=appuser:appgroup /app/.next/standalone ./
|
||||
COPY --from=builder --chown=appuser:appgroup /app/.next/static ./.next/static
|
||||
|
||||
USER appuser
|
||||
|
||||
EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
ENTRYPOINT ["dumb-init", "--"]
|
||||
CMD ["node", "server.js"]
|
||||
Reference in New Issue
Block a user