Docker update

This commit is contained in:
mukesh13
2025-06-23 19:35:50 +05:30
parent 96c78f779c
commit 5d37869331

View File

@ -1,34 +1,17 @@
# syntax=docker/dockerfile:1.4
# Build stage
FROM node:18-alpine AS build
FROM node:18 AS build
WORKDIR /app
# Update package database and install build dependencies
RUN apk update && apk add --no-cache python3 make g++ py3-pip
# Copy package files
COPY package.json package-lock.json ./
# Install dependencies
COPY package*.json ./
RUN npm install --legacy-peer-deps
# Copy source code
COPY . .
# Build the Gatsby app
RUN npm run build
# Production stage
FROM nginx:alpine AS production
FROM nginx:alpine
# Copy nginx config
RUN echo 'server { listen 80; root /usr/share/nginx/html; index index.html; location / { try_files $uri $uri/ /index.html; } }' > /etc/nginx/conf.d/default.conf
# Copy built files
COPY --from=build /app/public /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
EXPOSE 80