Build out the Dockerfile
This commit is contained in:
28
Dockerfile
28
Dockerfile
@@ -1,8 +1,28 @@
|
|||||||
#
|
#
|
||||||
# LMGCITFY Dockerfile
|
# LMGCITFY Dockerfile
|
||||||
#
|
#
|
||||||
FROM docker.io/library/node:22 AS prod
|
ARG nodever=22
|
||||||
RUN npm install && \
|
|
||||||
npm run build
|
# 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
|
EXPOSE 5000
|
||||||
ENTRYPOINT [ "npm", "run", "start" ]
|
ENTRYPOINT [ "node", "server.js" ]
|
||||||
|
|||||||
Reference in New Issue
Block a user