Enhance Docker setup by updating .dockerignore to include additional files and directories, modifying docker-compose.yml to add build arguments and Traefik labels, and improving the Dockerfile with build-time environment variables, health checks, and permission settings for security.

This commit is contained in:
2025-08-15 20:40:39 +01:00
parent ef211ebe0a
commit f7dc75d514
4 changed files with 340 additions and 41 deletions

View File

@ -5,13 +5,16 @@ services:
build:
context: .
dockerfile: Dockerfile
args:
- VITE_APP_NAME=ScriptShare
- VITE_APP_URL=http://localhost:3000
- VITE_ANALYTICS_ENABLED=false
ports:
- "3000:80"
environment:
- NODE_ENV=production
restart: unless-stopped
volumes:
- scriptshare_data:/usr/share/nginx/html
- scriptshare_logs:/var/log/nginx
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/health"]
@ -19,9 +22,11 @@ services:
timeout: 10s
retries: 3
start_period: 40s
labels:
- "traefik.enable=true"
- "traefik.http.routers.scriptshare.rule=Host(`scriptshare.localhost`)"
- "traefik.http.services.scriptshare.loadbalancer.server.port=80"
volumes:
scriptshare_data:
driver: local
scriptshare_logs:
driver: local