31 lines
583 B
Docker
31 lines
583 B
Docker
# Use a lightweight Node.js image
|
|
FROM node:22-alpine AS builder
|
|
|
|
# Set the working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package.json and install dependencies
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
|
|
# Copy the rest of the application code
|
|
COPY . .
|
|
|
|
# Build the Next.js application
|
|
RUN npm run build
|
|
|
|
# Use a new image for the production environment
|
|
FROM node:22-alpine AS runner
|
|
|
|
# Set the working directory
|
|
WORKDIR /app
|
|
|
|
# Copy built files from the builder stage
|
|
COPY --from=builder /app ./
|
|
|
|
# Expose the application port
|
|
EXPOSE 3000
|
|
|
|
# Command to run the application
|
|
CMD ["npm", "start"]
|