1
0
Code Issues Pull Requests Actions Packages Projects Releases Wiki Activity Security Code Quality
Files
cosmos-prototype-application/Dockerfile
2025-07-10 10:21:52 +07:00

39 lines
712 B
Docker

# 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"]