Build out the Dockerfile
This commit is contained in:
28
Dockerfile
28
Dockerfile
@@ -1,8 +1,28 @@
|
||||
#
|
||||
# LMGCITFY Dockerfile
|
||||
#
|
||||
FROM docker.io/library/node:22 AS prod
|
||||
RUN npm install && \
|
||||
npm run build
|
||||
ARG nodever=22
|
||||
|
||||
# STAGE 1: Build the application
|
||||
FROM docker.io/library/node:$nodever-alpine AS builder
|
||||
WORKDIR /app
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
COPY ./ ./
|
||||
RUN npm run build
|
||||
|
||||
# STAGE 2: Prod build
|
||||
FROM docker.io/library/node:$nodever-alpine AS prod
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
RUN addgroup -S nextjs && adduser -S nextjs -G nextjs
|
||||
# Copy standalone server and assets
|
||||
COPY --from=builder /app/.next/standalone ./
|
||||
COPY --from=builder /app/.next/static ./.next/static
|
||||
COPY --from=builder /app/public ./public
|
||||
# Jump in
|
||||
USER nextjs
|
||||
EXPOSE 5000
|
||||
ENTRYPOINT [ "npm", "run", "start" ]
|
||||
ENTRYPOINT [ "node", "server.js" ]
|
||||
|
||||
Reference in New Issue
Block a user