| # | |
| # Licensed to the Apache Software Foundation (ASF) under one or more | |
| # contributor license agreements. See the NOTICE file distributed with | |
| # this work for additional information regarding copyright ownership. | |
| # The ASF licenses this file to You under the Apache License, Version 2.0 | |
| # (the "License"); you may not use this file except in compliance with | |
| # the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # | |
| # ----------------------------------------------------------------------- | |
| # We don't support docker compose for production environments. | |
| # If you choose to use this type of deployment make sure to | |
| # create you own docker environment file (docker/.env) with your own | |
| # unique random secure passwords and SECRET_KEY. | |
| # | |
| # For verbose logging during development: | |
| # - Set SUPERSET_LOG_LEVEL=debug in docker/.env-local for detailed Superset logs | |
| # ----------------------------------------------------------------------- | |
| x-superset-user: &superset-user root | |
| x-superset-volumes: &superset-volumes | |
| # /app/pythonpath_docker will be appended to the PYTHONPATH in the final container | |
| - ./docker:/app/docker | |
| - ./superset:/app/superset | |
| - ./superset-core:/app/superset-core | |
| - ./superset-frontend:/app/superset-frontend | |
| - superset_home:/app/superset_home | |
| - ./tests:/app/tests | |
| - superset_data:/app/data | |
| - ./local_extensions:/app/local_extensions | |
| x-common-build: &common-build | |
| context: . | |
| target: ${SUPERSET_BUILD_TARGET:-dev} # dev (default, live-reload); also `superset` (batteries-included) or `lean` (minimal) | |
| cache_from: | |
| - apache/superset-cache:3.11-slim-trixie | |
| - apache/superset-cache:3.11-slim-trixie-arm64 | |
| args: | |
| DEV_MODE: "true" | |
| INCLUDE_CHROMIUM: ${INCLUDE_CHROMIUM:-false} | |
| BUILD_TRANSLATIONS: ${BUILD_TRANSLATIONS:-false} | |
| services: | |
| nginx: | |
| env_file: | |
| - path: docker/.env # default | |
| required: true | |
| - path: docker/.env-local # optional override | |
| required: false | |
| image: nginx:latest | |
| restart: unless-stopped | |
| ports: | |
| - "${NGINX_PORT:-80}:80" | |
| extra_hosts: | |
| - "host.docker.internal:host-gateway" | |
| volumes: | |
| - ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro | |
| - ./docker/nginx/templates:/etc/nginx/templates:ro | |
| # 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 | |
| - | | |
| url="http://host.docker.internal:9000/static/assets/manifest.json" | |
| max_attempts=300 # ~10 minutes at 2s intervals; first build can be slow | |
| echo "Waiting for webpack dev server at $$url..." | |
| attempt=0 | |
| until curl -sf --max-time 5 -H "Host: localhost" -o /dev/null "$$url"; do | |
| attempt=$$((attempt + 1)) | |
| if [ "$$attempt" -ge "$$max_attempts" ]; then | |
| echo "ERROR: webpack dev server did not serve $$url after $$max_attempts attempts." >&2 | |
| echo "Is the dev server running? With BUILD_SUPERSET_FRONTEND_IN_DOCKER=false you must start it on the host (e.g. 'npm run dev' in superset-frontend)." >&2 | |
| exit 1 | |
| fi | |
| if [ $$((attempt % 15)) -eq 0 ]; then | |
| echo "Still waiting for webpack dev server... ($$attempt/$$max_attempts)" | |
| fi | |
| sleep 2 | |
| done | |
| echo "Webpack dev server is ready; starting nginx." | |
| exec /docker-entrypoint.sh nginx -g 'daemon off;' | |
| redis: | |
| image: redis:7 | |
| restart: unless-stopped | |
| ports: | |
| - "127.0.0.1:${REDIS_PORT:-6379}:6379" | |
| volumes: | |
| - redis:/data | |
| db: | |
| env_file: | |
| - path: docker/.env # default | |
| required: true | |
| - path: docker/.env-local # optional override | |
| required: false | |
| image: postgres:17 | |
| restart: unless-stopped | |
| ports: | |
| - "127.0.0.1:${DATABASE_PORT:-5432}:5432" | |
| volumes: | |
| - db_home:/var/lib/postgresql/data | |
| - ./docker/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d | |
| superset: | |
| env_file: | |
| - path: docker/.env # default | |
| required: true | |
| - path: docker/.env-local # optional override | |
| required: false | |
| build: | |
| <<: *common-build | |
| command: ["/app/docker/docker-bootstrap.sh", "app"] | |
| restart: unless-stopped | |
| ports: | |
| - ${SUPERSET_PORT:-8088}:8088 | |
| extra_hosts: | |
| - "host.docker.internal:host-gateway" | |
| user: *superset-user | |
| depends_on: | |
| superset-init: | |
| condition: service_completed_successfully | |
| volumes: *superset-volumes | |
| superset-websocket: | |
| build: ./superset-websocket | |
| ports: | |
| - ${WEBSOCKET_PORT:-8080}:8080 | |
| extra_hosts: | |
| - "host.docker.internal:host-gateway" | |
| depends_on: | |
| - redis | |
| # Mount everything in superset-websocket into container and | |
| # then exclude node_modules and dist with bogus volume mount. | |
| # This is necessary because host and container need to have | |
| # their own, separate versions of these files. .dockerignore | |
| # does not seem to work when starting the service through | |
| # docker compose. | |
| # | |
| # For example, node_modules may contain libs with native bindings. | |
| # Those bindings need to be compiled for each OS and the container | |
| # OS is not necessarily the same as host OS. | |
| volumes: | |
| - ./superset-websocket:/home/superset-websocket | |
| - /home/superset-websocket/node_modules | |
| - /home/superset-websocket/dist | |
| # Mount config file. Create your own docker/superset-websocket/config.json | |
| # for custom settings, then point to it here. Do not use this example in production. | |
| - ./docker/superset-websocket/config.example.json:/home/superset-websocket/config.json:ro | |
| environment: | |
| - PORT=8080 | |
| - REDIS_HOST=redis | |
| - REDIS_PORT=6379 | |
| - REDIS_SSL=false | |
| superset-init: | |
| build: | |
| <<: *common-build | |
| command: ["/app/docker/docker-init.sh"] | |
| env_file: | |
| - path: docker/.env # default | |
| required: true | |
| - path: docker/.env-local # optional override | |
| required: false | |
| depends_on: | |
| db: | |
| condition: service_started | |
| redis: | |
| condition: service_started | |
| user: *superset-user | |
| volumes: *superset-volumes | |
| environment: | |
| SUPERSET_FORCE_LOAD_EXAMPLES: "${SUPERSET_FORCE_LOAD_EXAMPLES:-}" | |
| healthcheck: | |
| disable: true | |
| superset-node: | |
| build: | |
| context: . | |
| target: superset-node | |
| args: | |
| # This prevents building the frontend bundle since we'll mount local folder | |
| # and build it on startup while firing docker-frontend.sh in dev mode, where | |
| # it'll mount and watch local files and rebuild as you update them | |
| DEV_MODE: "true" | |
| BUILD_TRANSLATIONS: ${BUILD_TRANSLATIONS:-false} | |
| environment: | |
| # set this to false if you have perf issues running the npm i; npm run dev in-docker | |
| # if you do so, you have to run this manually on the host, which should perform better! | |
| BUILD_SUPERSET_FRONTEND_IN_DOCKER: true | |
| NPM_RUN_PRUNE: false | |
| SCARF_ANALYTICS: "${SCARF_ANALYTICS:-}" | |
| # configuring the dev-server to use the host.docker.internal to connect to the backend | |
| superset: "http://superset:8088" | |
| # Webpack dev server must bind to 0.0.0.0 to be accessible from outside the container | |
| WEBPACK_DEVSERVER_HOST: "0.0.0.0" | |
| ports: | |
| - "127.0.0.1:${NODE_PORT:-9000}:9000" # exposing the dynamic webpack dev server | |
| command: ["/app/docker/docker-frontend.sh"] | |
| env_file: | |
| - path: docker/.env # default | |
| required: true | |
| - path: docker/.env-local # optional override | |
| required: false | |
| # Same shared bind mounts as the other services (repeated rather than | |
| # aliased so an anonymous volume can be added over node_modules, keeping | |
| # it container-managed). docker-frontend.sh now runs `npm ci`, which | |
| # deletes node_modules before reinstalling; without this the delete+ | |
| # recreate lands directly on the host's bind-mounted directory, and this | |
| # container has no `user: *superset-user` override (unlike | |
| # superset-init/superset/superset-worker*), so it runs as the image's | |
| # default root user and leaves the host copy root-owned. | |
| volumes: | |
| - ./docker:/app/docker | |
| - ./superset:/app/superset | |
| - ./superset-core:/app/superset-core | |
| - ./superset-frontend:/app/superset-frontend | |
| - /app/superset-frontend/node_modules | |
| - superset_home:/app/superset_home | |
| - ./tests:/app/tests | |
| - superset_data:/app/data | |
| - ./local_extensions:/app/local_extensions | |
| superset-worker: | |
| build: | |
| <<: *common-build | |
| command: ["/app/docker/docker-bootstrap.sh", "worker"] | |
| env_file: | |
| - path: docker/.env # default | |
| required: true | |
| - path: docker/.env-local # optional override | |
| required: false | |
| environment: | |
| CELERYD_CONCURRENCY: 2 | |
| restart: unless-stopped | |
| depends_on: | |
| superset-init: | |
| condition: service_completed_successfully | |
| user: *superset-user | |
| volumes: *superset-volumes | |
| extra_hosts: | |
| - "host.docker.internal:host-gateway" | |
| healthcheck: | |
| test: ["CMD-SHELL", "celery -A superset.tasks.celery_app:app inspect ping -d celery@$$HOSTNAME"] | |
| # Bump memory limit if processing screenshots / thumbnails on superset-worker | |
| # mem_limit: 2038m | |
| # mem_reservation: 128M | |
| superset-worker-beat: | |
| build: | |
| <<: *common-build | |
| command: ["/app/docker/docker-bootstrap.sh", "beat"] | |
| env_file: | |
| - path: docker/.env # default | |
| required: true | |
| - path: docker/.env-local # optional override | |
| required: false | |
| restart: unless-stopped | |
| depends_on: | |
| - superset-worker | |
| user: *superset-user | |
| volumes: *superset-volumes | |
| healthcheck: | |
| disable: true | |
| superset-tests-worker: | |
| build: | |
| <<: *common-build | |
| command: ["/app/docker/docker-bootstrap.sh", "worker"] | |
| env_file: | |
| - path: docker/.env # default | |
| required: true | |
| - path: docker/.env-local # optional override | |
| required: false | |
| profiles: | |
| - optional | |
| environment: | |
| DATABASE_HOST: localhost | |
| DATABASE_DB: test | |
| REDIS_CELERY_DB: 2 | |
| REDIS_RESULTS_DB: 3 | |
| REDIS_HOST: localhost | |
| CELERYD_CONCURRENCY: 8 | |
| network_mode: host | |
| depends_on: | |
| superset-init: | |
| condition: service_completed_successfully | |
| user: *superset-user | |
| volumes: *superset-volumes | |
| healthcheck: | |
| test: ["CMD-SHELL", "celery inspect ping -A superset.tasks.celery_app:app -d celery@$$HOSTNAME"] | |
| volumes: | |
| superset_home: | |
| external: false | |
| db_home: | |
| external: false | |
| redis: | |
| external: false | |
| superset_data: | |
| external: false |