chore: dockerfile review mode prod
This commit is contained in:
29
Dockerfile
29
Dockerfile
@@ -1,5 +1,5 @@
|
|||||||
# Use Node.js LTS version
|
# Build stage
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine AS builder
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -17,9 +17,30 @@ RUN yarn install --frozen-lockfile
|
|||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build the application
|
# Build the application
|
||||||
|
RUN yarn build
|
||||||
|
|
||||||
|
# Production stage
|
||||||
|
FROM node:20-alpine AS runner
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Enable Yarn
|
||||||
|
RUN corepack enable
|
||||||
|
|
||||||
|
# Copy package files and install production dependencies only
|
||||||
|
COPY package.json yarn.lock* ./
|
||||||
|
RUN yarn install --production --frozen-lockfile
|
||||||
|
|
||||||
|
# Copy built application from builder stage
|
||||||
|
COPY --from=builder /app/.next ./.next
|
||||||
|
COPY --from=builder /app/public ./public
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
# Expose the port the app runs on
|
# Expose the port the app runs on
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
# Start the application in production mode by default
|
# Start the application in production mode
|
||||||
CMD ["yarn", "dev"]
|
CMD ["yarn", "start"]
|
||||||
Reference in New Issue
Block a user