4NK_IA_front/Dockerfile

30 lines
600 B
Docker

# syntax=docker/dockerfile:1.7-labs
# ---- Build stage ----
FROM node:20.19-alpine AS build
WORKDIR /app
# Install dependencies
COPY package*.json ./
RUN npm ci --ignore-scripts
# Copy sources
COPY . .
# Ensure correct Node version for build via prebuild script
RUN npm run build
# ---- Runtime stage ----
FROM nginx:alpine AS runtime
# Copy SPA build
COPY --from=build /app/dist /usr/share/nginx/html
# Nginx config for SPA routing and caching
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
HEALTHCHECK CMD wget -qO- http://localhost/ || exit 1
CMD ["nginx", "-g", "daemon off;"]