This commit is contained in:
Mackie 2026-06-08 07:58:15 +08:00
parent ada0be589f
commit 96a1168822
2 changed files with 22 additions and 11 deletions

View file

@ -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;"]

View file

@ -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;
}