Dockerupdate
This commit is contained in:
24
Dockerfile
24
Dockerfile
@ -1,18 +1,17 @@
|
|||||||
# syntax=docker/dockerfile:1.4
|
# syntax=docker/dockerfile:1.4
|
||||||
|
|
||||||
# Use Alpine - no apt-get, much faster!
|
|
||||||
FROM node:18-alpine AS development
|
FROM node:18-alpine AS development
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install build tools with apk (seconds vs minutes)
|
# Install build dependencies
|
||||||
RUN apk add --no-cache python3 make g++
|
RUN apk add --no-cache python3 make g++
|
||||||
|
|
||||||
# Copy package files first for better layer caching
|
# Copy package files
|
||||||
COPY package.json package-lock.json* ./
|
COPY package.json package-lock.json ./
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN npm ci --legacy-peer-deps --no-optional
|
RUN npm ci --legacy-peer-deps
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code
|
||||||
COPY . .
|
COPY . .
|
||||||
@ -29,10 +28,17 @@ RUN npm run build
|
|||||||
# Production stage
|
# Production stage
|
||||||
FROM nginx:alpine AS production
|
FROM nginx:alpine AS production
|
||||||
|
|
||||||
# Copy nginx config if it exists, otherwise use default
|
WORKDIR /usr/share/nginx/html
|
||||||
COPY --from=build /app/.nginx/nginx.conf /etc/nginx/conf.d/default.conf 2>/dev/null || echo "Using default nginx config"
|
|
||||||
|
# Remove default nginx files
|
||||||
|
RUN rm -rf ./*
|
||||||
|
|
||||||
# Copy built app
|
# Copy built app
|
||||||
COPY --from=build /app/build /usr/share/nginx/html
|
COPY --from=build /app/build .
|
||||||
|
|
||||||
|
# Copy nginx config if it exists
|
||||||
|
COPY .nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
||||||
Reference in New Issue
Block a user