From 96a1168822aa6b4cd96233e716286be5fd7048f9 Mon Sep 17 00:00:00 2001 From: Mackie Date: Mon, 8 Jun 2026 07:58:15 +0800 Subject: [PATCH] 32 --- Dockerfile | 9 ++++++++- nginx.conf | 24 ++++++++++++++---------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index d5fd231..5534532 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,5 +11,12 @@ FROM nginx:alpine COPY --from=builder /app/dist /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf # ... previous steps -EXPOSE 3000 +EXPOSE 80 +# ... (your existing build steps) + +# Add this line at the end of your Dockerfile +# This tells Docker (and Dokploy) how to check if your app is alive +HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ + CMD curl -f http://localhost/ || exit 1 + CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/nginx.conf b/nginx.conf index cd9dfd7..929e5ef 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,21 +1,25 @@ server { listen 80; - - # 1. Handle the path Traefik is routing - location /lab/data-dashboard/ { - alias /usr/share/nginx/html/; - try_files $uri $uri/ /index.html; - } + root /usr/share/nginx/html; + index index.html; - # 2. Add an explicit health check endpoint (returns 200 OK) + # Dedicated Health Check Endpoint location /health { return 200 'healthy'; add_header Content-Type text/plain; } - # 3. Fallback for SPA routing - location / { - root /usr/share/nginx/html; + # Your SPA routing (aliased to handle the sub-path) + location /lab/data-dashboard/ { + alias /usr/share/nginx/html/; try_files $uri $uri/ /index.html; } + + # Fallback for the root domain + location / { + try_files $uri $uri/ /index.html; + } + + gzip on; + gzip_types text/css application/javascript application/json; } \ No newline at end of file