Files
nobat724_front/dockerfile
T
2025-04-09 11:55:30 +03:30

40 lines
774 B
Docker

FROM node:22-alpine AS builder
WORKDIR /app
# Install system dependencies for native modules
RUN apk add --no-cache python3 make g++ git
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install --force
# Copy source code
COPY . .
# Build Next.js application
RUN npm run build
# Production stage
FROM node:22-alpine AS production
WORKDIR /app
# Enable production mode
ENV NODE_ENV production
# Install dependencies for production (curl for health checks)
RUN apk add --no-cache curl
# Copy built assets from builder
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public
# Expose the Next.js port
EXPOSE 3000
# Start the server
CMD ["node", "server.js"]