diff options
| author | Adam Malczewski <[email protected]> | 2026-03-15 15:46:00 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-03-15 15:46:00 +0900 |
| commit | 0254a6936139801ee10fac27cc5032258d13051d (patch) | |
| tree | 2169ab1a0d7c4979947f999e9e57a8e1be19b299 /Dockerfile.prod | |
| parent | e30116153f29ea8b634c31c080130f1a5d6f0d06 (diff) | |
| download | tirecalc-main.tar.gz tirecalc-main.zip | |
Diffstat (limited to 'Dockerfile.prod')
| -rw-r--r-- | Dockerfile.prod | 44 |
1 files changed, 44 insertions, 0 deletions
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;"] |
