Files
nonograms/Dockerfile
2026-02-08 04:27:43 +01:00

39 lines
944 B
Docker

# Stage 1: Build the application
FROM node:lts-alpine as build-stage
# Set working directory
WORKDIR /app
# Copy package files first to leverage Docker cache
COPY package*.json ./
# Install dependencies
# using npm ci for cleaner, reliable builds (requires package-lock.json)
RUN npm ci
# Copy the rest of the application code
COPY . .
# Build the application
RUN npm run build
# Stage 2: Serve the application with Nginx
FROM nginx:stable-alpine as production-stage
# Copy the built artifacts from the build stage
# Assuming Vite defaults to /app/dist
COPY --from=build-stage /app/dist /usr/share/nginx/html
# Copy custom Nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80
EXPOSE 80
# Healthcheck to ensure Nginx is running and serving
HEALTHCHECK --interval=30s --timeout=3s \
CMD wget --quiet --tries=1 --spider http://localhost/health || exit 1
# Start Nginx
CMD ["nginx", "-g", "daemon off;"]