Docker update
This commit is contained in:
25
Dockerfile
25
Dockerfile
@ -1,34 +1,17 @@
|
|||||||
# syntax=docker/dockerfile:1.4
|
|
||||||
|
|
||||||
# Build stage
|
# Build stage
|
||||||
FROM node:18-alpine AS build
|
FROM node:18 AS build
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Update package database and install build dependencies
|
COPY package*.json ./
|
||||||
RUN apk update && apk add --no-cache python3 make g++ py3-pip
|
|
||||||
|
|
||||||
# Copy package files
|
|
||||||
COPY package.json package-lock.json ./
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
RUN npm install --legacy-peer-deps
|
RUN npm install --legacy-peer-deps
|
||||||
|
|
||||||
# Copy source code
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build the Gatsby app
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Production stage
|
# 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
|
COPY --from=build /app/public /usr/share/nginx/html
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
|
||||||
Reference in New Issue
Block a user