- docker-compose.yml (dev): 3 services — postgres:16, backend (gradle bootRun with JDK 21, spring-boot-devtools), frontend (Vite HMR on node:24-alpine). Source volume mounts for live editing, Gradle cache volume for fast rebuilds, pg_isready healthcheck on postgres. - docker-compose.prod.yml (prod): same 3 services but with multi-stage Dockerfiles. Backend: Gradle bootJar → JRE Alpine, non-root user. Frontend: npm ci + vite build → nginx:alpine serving static dist/. SSL termination via self-signed cert (auto-generated in entrypoint). No source mounts, restart: unless-stopped, separate volumes. - application-docker.yml: Spring profile overriding H2 with PostgreSQL via env vars. Hostname "postgres" resolved by Docker Compose DNS. - Vite proxy /api → backend:8080 for dev. nginx nginx.conf handles /api proxy + SPA fallback + gzip + SSL in prod. - AGENTS.md, README.md: architecture diagram, dev vs prod comparison table, Spring profiles docs, file reference updates.
30 lines
817 B
Nginx Configuration File
30 lines
817 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
listen 443 ssl;
|
|
server_name _;
|
|
|
|
ssl_certificate /etc/nginx/certs/cert.crt;
|
|
ssl_certificate_key /etc/nginx/certs/cert.key;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
location /api/ {
|
|
proxy_pass http://backend:8080;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
}
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript image/svg+xml;
|
|
gzip_vary on;
|
|
gzip_min_length 256;
|
|
}
|