Update Dockerfile
هذا الالتزام موجود في:
31
Dockerfile
31
Dockerfile
@@ -1,5 +1,5 @@
|
||||
# Build stage
|
||||
FROM node:18-alpine AS builder
|
||||
# Use Node.js base image
|
||||
FROM node:18-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -8,9 +8,9 @@ COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
||||
|
||||
# Install dependencies
|
||||
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 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; \
|
||||
fi
|
||||
|
||||
@@ -20,23 +20,8 @@ COPY . .
|
||||
# Build the app
|
||||
RUN npm run build
|
||||
|
||||
# Production stage
|
||||
FROM nginx:alpine
|
||||
# Expose port 3000 (Next.js default port)
|
||||
EXPOSE 3000
|
||||
|
||||
# Copy nginx configuration
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# 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;"]
|
||||
# Start Next.js production server
|
||||
CMD ["npm", "start"]
|
المرجع في مشكلة جديدة
حظر مستخدم