1
0
Code Issues Pull Requests Actions Packages Projects Releases Wiki Activity Security Code Quality

Add docker

This commit is contained in:
2025-07-10 10:21:52 +07:00
parent ec6f0871b4
commit 1d505b8639
2 changed files with 66 additions and 0 deletions

39
Dockerfile Normal file
View File

@@ -0,0 +1,39 @@
# Base image
FROM node:22-alpine AS builder
ARG NODE_ENV=production
ARG MONGODB_URI
ARG MONGODB_DB
# Create app directory
WORKDIR /app
# Install dependencies
COPY package.json package-lock.json* ./
RUN npm ci
# Copy the rest of the application
COPY . .
# Build the app
RUN npm run build
# Production image
FROM node:22-alpine AS runner
WORKDIR /app
# Copy only necessary files
COPY --from=builder /app/package.json ./
COPY --from=builder /app/.next .next
COPY --from=builder /app/public ./public
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/next.config.ts ./
# Set environment variables (optional)
# Expose port
EXPOSE 3000
# Start the application
CMD ["npm", "start"]