From 05d44290d21bef0b49593f9139d84808c61ef547 Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Thu, 28 May 2026 11:47:44 +0200 Subject: [PATCH] chore: add Dockerfile and nginx config for Coolify deployment --- .dockerignore | 6 ++++++ Dockerfile | 20 ++++++++++++++++++++ nginx.conf | 23 +++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..687c5a4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +node_modules +dist +.git +.vscode +*.log +.DS_Store diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..11d1661 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM node:22-alpine AS builder +WORKDIR /app + +COPY package*.json ./ +RUN npm ci + +COPY . . +RUN npm run build + +FROM nginx:1.27-alpine AS runner + +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=builder /app/dist /usr/share/nginx/html + +EXPOSE 80 + +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD wget -qO- http://localhost/ > /dev/null || exit 1 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..2d705ad --- /dev/null +++ b/nginx.conf @@ -0,0 +1,23 @@ +server { + listen 80; + server_name _; + root /usr/share/nginx/html; + index index.html; + + gzip on; + gzip_types text/plain text/css application/javascript application/json image/svg+xml; + gzip_min_length 256; + + # Cache hashed assets aggressively + location /assets/ { + expires 1y; + add_header Cache-Control "public, immutable"; + try_files $uri =404; + } + + # SPA fallback (single page; no client routing here, but harmless) + location / { + try_files $uri $uri/ /index.html; + add_header Cache-Control "no-cache"; + } +}