Update Dockerfile

هذا الالتزام موجود في:
2025-09-08 10:27:46 +00:00
الأصل 6c9b54226d
التزام 44db42d2a2

عرض الملف

@@ -1,5 +1,5 @@
# Build stage # Use Node.js base image
FROM node:18-alpine AS builder FROM node:18-alpine
WORKDIR /app WORKDIR /app
@@ -8,9 +8,9 @@ COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
# Install dependencies # Install dependencies
RUN \ RUN \
if [ -f yarn.lock ]; then yarn install; \ if [ -f yarn.lock ]; then yarn install --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \ elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i; \ elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm install --frozen-lockfile; \
else npm install; \ else npm install; \
fi fi
@@ -20,23 +20,8 @@ COPY . .
# Build the app # Build the app
RUN npm run build RUN npm run build
# Production stage # Expose port 3000 (Next.js default port)
FROM nginx:alpine EXPOSE 3000
# Copy nginx configuration # Start Next.js production server
COPY nginx.conf /etc/nginx/nginx.conf CMD ["npm", "start"]
# Create the html directory if it doesn't exist
RUN mkdir -p /usr/share/nginx/html
# Remove any existing files in html directory
RUN rm -rf /usr/share/nginx/html/*
# Copy built app from builder stage
COPY --from=builder /app/.next /usr/share/nginx/html
# Expose port 80
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]