Files
rootxwire1/Dockerfile
2025-06-23 17:02:45 +05:30

34 lines
702 B
Docker

# syntax=docker/dockerfile:1.4
# Build stage
FROM node:18-alpine AS build
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache python3 make g++
# Copy package files
COPY package.json package-lock.json ./
# Install dependencies
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
# 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;"]