mirror of
https://github.com/khoaliber/LetterFeed.git
synced 2026-03-02 05:29:13 +00:00
34 lines
685 B
Docker
34 lines
685 B
Docker
# Dockerfile for Next.js frontend
|
|
|
|
# 1. Build Stage
|
|
FROM node:24-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
# Copy package.json and package-lock.json
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm install
|
|
|
|
# Copy the rest of the application
|
|
COPY . .
|
|
|
|
# Build the Next.js application
|
|
RUN npm run build
|
|
|
|
# 2. Production Stage
|
|
FROM node:24-alpine
|
|
WORKDIR /app
|
|
|
|
# Copy the built application from the builder stage
|
|
COPY --from=builder /app/.next ./.next
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder /app/package.json ./package.json
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
|
|
# Expose the port the app runs on
|
|
EXPOSE 3000
|
|
|
|
# Start the application
|
|
CMD ["npm", "start"]
|