58 lines
1.4 KiB
Docker
58 lines
1.4 KiB
Docker
## Multi-stage Dockerfile for MenuScene (Vite + Needle)
|
|
# Dev stage: runs Vite with HTTPS on port 3000
|
|
# FROM node:18-alpine AS dev
|
|
|
|
# WORKDIR /app
|
|
|
|
# # Install dependencies first (better layer caching)
|
|
# COPY package.json package-lock.json ./
|
|
# RUN npm ci --no-audit --no-fund
|
|
|
|
# # Copy the rest of the app
|
|
# COPY . .
|
|
|
|
# # Expose Vite dev server port
|
|
# EXPOSE 3000
|
|
|
|
# # Vite needs HTTPS for this project. The config already enables https and strictPort: 3000
|
|
# ENV NODE_ENV=development
|
|
|
|
# CMD ["npm", "run", "start"]
|
|
|
|
|
|
# Build stage: produce optimized static assets
|
|
FROM node:18-alpine AS build
|
|
|
|
USER root
|
|
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --no-audit --no-fund
|
|
COPY . .
|
|
RUN npm run build:production
|
|
USER node
|
|
|
|
FROM devgeoanalysis/minideb:bookworm as certgen
|
|
|
|
RUN mkdir /certs && apt-get update -y && apt-get install -y wget && \
|
|
wget https://github.com/minio/certgen/releases/download/v1.3.0/certgen_1.3.0_linux_amd64.deb && \
|
|
apt-get install -y ./certgen_1.3.0_linux_amd64.deb
|
|
|
|
WORKDIR /certs
|
|
RUN certgen -host "192.168.1.11"
|
|
|
|
# Production stage: serve static files via nginx
|
|
FROM nginx:1.25-alpine AS prod
|
|
|
|
RUN mkdir /certs
|
|
|
|
COPY --from=certgen /certs /certs
|
|
|
|
# Copy build output
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Serve on port 8080 (container). Map as needed from host
|
|
EXPOSE 8080
|
|
|
|
CMD ["nginx", "-g", "daemon off;"] |