Adiciona infra de deploy: Dockerfile multi-stage + nginx + .dockerignore
- Dockerfile: build com Node 20 (vite build) -> serve com nginx alpine - nginx.conf: SPA routing, cache de assets versionados, healthcheck - .dockerignore: exclui node_modules, dist e configs de IDE do contexto
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# SPA routing — 404s caem no index.html (i18next/react-router lidam)
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Cache agressivo para assets versionados (Vite gera hash no nome)
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|webp|avif)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# index.html nunca cacheia (pega versão nova após deploy)
|
||||
location = /index.html {
|
||||
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
||||
}
|
||||
|
||||
# Healthcheck
|
||||
location = /healthz {
|
||||
access_log off;
|
||||
return 200 "ok\n";
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user