From 0254a6936139801ee10fac27cc5032258d13051d Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Sun, 15 Mar 2026 15:46:00 +0900 Subject: update to work with dokploy --- Dockerfile.prod | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Dockerfile.prod (limited to 'Dockerfile.prod') diff --git a/Dockerfile.prod b/Dockerfile.prod new file mode 100644 index 0000000..a1a792c --- /dev/null +++ b/Dockerfile.prod @@ -0,0 +1,44 @@ +# -------------------------------------------------------------------------- +# Dockerfile.prod — Production multi-stage build for the Bicycle Wheel +# Circumference app. +# +# Stage 1 (build): +# • Installs dependencies and runs `npm run build` to produce a static +# bundle in /app/dist. +# +# Stage 2 (production): +# • Copies the built assets into an Nginx Alpine image. +# • Uses a custom nginx.conf that handles SPA routing (all paths +# fall back to index.html). +# • Serves on port 80 — Traefik/Dokploy will handle TLS termination. +# -------------------------------------------------------------------------- + +# ---- Build stage ---- +FROM node:25-alpine AS build + +WORKDIR /app + +# Install dependencies first (layer caching optimisation) +COPY package.json package-lock.json ./ +RUN npm ci + +# Copy the rest of the source and build +COPY . . +RUN npm run build + +# ---- Production stage ---- +FROM nginx:stable-alpine AS production + +# Remove default Nginx site config +RUN rm /etc/nginx/conf.d/default.conf + +# Add custom Nginx config for SPA routing +COPY nginx.conf /etc/nginx/conf.d/default.conf + +# Copy built assets from the build stage +COPY --from=build /app/dist /usr/share/nginx/html + +EXPOSE 80 + +# Nginx runs in the foreground by default with the official image +CMD ["nginx", "-g", "daemon off;"] -- cgit v1.2.3