mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-02-04 17:41:23 +01:00
fix: update Dockerfile to use multi-stage build for optimized production image
This commit is contained in:
parent
5588444d01
commit
926eda7cb0
1 changed files with 21 additions and 2 deletions
23
Dockerfile
23
Dockerfile
|
|
@ -1,7 +1,26 @@
|
||||||
|
# Build stage
|
||||||
|
FROM node:20-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package files
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
# Copy source code
|
||||||
|
COPY ./src ./src
|
||||||
|
COPY vite.config.js .
|
||||||
|
|
||||||
|
# Build the application
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Production stage
|
||||||
FROM nginx:stable-alpine
|
FROM nginx:stable-alpine
|
||||||
|
|
||||||
# Copy the contents of the repo to the container
|
# Copy built files from builder stage
|
||||||
COPY ./dist /usr/share/nginx/html
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
# Move the customized nginx config file to the nginx folder
|
# Move the customized nginx config file to the nginx folder
|
||||||
RUN mv /usr/share/nginx/html/.docker/default.conf /etc/nginx/conf.d/default.conf
|
RUN mv /usr/share/nginx/html/.docker/default.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue