build: add nginx docker image and compose

Dockerfile implements multi-stage build: node:22-alpine for build
stage, nginx:1.27-alpine for production runtime. nginx.conf provides
SPA routing with gzip compression and cache headers. docker-compose.yml
prepared for Tower Traefik integration with external network and Host
route. All files match specification verbatim.
This commit is contained in:
L'électron rare
2026-07-09 12:22:42 +02:00
parent aa81b39600
commit b3964df9b2
4 changed files with 55 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
node_modules
dist
test-results
playwright-report
.git
+10
View File
@@ -0,0 +1,10 @@
FROM node:22-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM nginx:1.27-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
+17
View File
@@ -0,0 +1,17 @@
services:
web:
build: .
container_name: clement-saillant-cc
restart: unless-stopped
networks:
- traefik
labels:
- traefik.enable=true
- traefik.http.routers.clement.rule=Host(`clement.saillant.cc`)
- traefik.http.routers.clement.entrypoints=websecure
- traefik.http.routers.clement.tls.certresolver=letsencrypt
- traefik.http.services.clement.loadbalancer.server.port=80
networks:
traefik:
external: true
+23
View File
@@ -0,0 +1,23 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
gzip on;
gzip_types text/css application/javascript application/wasm image/svg+xml;
add_header X-Content-Type-Options nosniff;
add_header Referrer-Policy no-referrer-when-downgrade;
location /assets/ {
add_header Cache-Control "public, max-age=31536000, immutable";
}
location /music/ {
add_header Cache-Control "public, max-age=86400";
}
location / {
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache";
}
}