commit 6c9b54226d660963b443f3db755711b7d1862427 Author: ghaymah_dev Date: Mon Sep 8 10:18:08 2025 +0000 Add Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9d193c1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +# Build stage +FROM node:18-alpine AS builder + +WORKDIR /app + +# Copy package files +COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ + +# Install dependencies +RUN \ + if [ -f yarn.lock ]; then yarn install; \ + elif [ -f package-lock.json ]; then npm ci; \ + elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i; \ + else npm install; \ + fi + +# Copy source code +COPY . . + +# Build the app +RUN npm run build + +# Production stage +FROM nginx:alpine + +# 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;"] \ No newline at end of file