diff --git a/docker-compose.yml b/docker-compose.yml index 2d7b2b54b85..e4ea2db0591 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -61,9 +61,22 @@ services: volumes: - ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro - ./docker/nginx/templates:/etc/nginx/templates:ro - depends_on: - superset-node: - condition: service_healthy + # Wait for the webpack dev server's manifest.json to be served before + # starting nginx. This prevents 404s on static assets at startup. The + # probe targets host.docker.internal so it works regardless of whether + # the dev server runs in the superset-node container + # (BUILD_SUPERSET_FRONTEND_IN_DOCKER=true, the default) or directly on + # the host (BUILD_SUPERSET_FRONTEND_IN_DOCKER=false). + command: + - /bin/bash + - -c + - | + echo "Waiting for webpack dev server at host.docker.internal:9000/static/assets/manifest.json..." + until curl -sf -o /dev/null http://host.docker.internal:9000/static/assets/manifest.json; do + sleep 2 + done + echo "Webpack dev server is ready; starting nginx." + exec nginx -g 'daemon off;' redis: image: redis:7 @@ -189,14 +202,6 @@ services: - path: docker/.env-local # optional override required: false volumes: *superset-volumes - healthcheck: - # Check if webpack dev server is responding on port 9000 - # This prevents nginx from proxying before the frontend is ready - test: ["CMD-SHELL", "node -e \"const http = require('http'); http.get('http://localhost:9000', (r) => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))\""] - interval: 10s - timeout: 5s - retries: 30 - start_period: 60s superset-worker: build: