diff --git a/docs/docs/installation/docker-builds.mdx b/docs/docs/installation/docker-builds.mdx index 93afa08606e..eaf60a35dc9 100644 --- a/docs/docs/installation/docker-builds.mdx +++ b/docs/docs/installation/docker-builds.mdx @@ -64,6 +64,51 @@ check the [supersetbot docker](https://github.com/apache-superset/supersetbot) subcommand and the [docker.yml](https://github.com/apache/superset/blob/master/.github/workflows/docker.yml) GitHub action. +## Building your own production Docker image + +Every Superset deployment will require its own set of drivers depending on the data warehouse(s), +etc. so we recommend that users build their own Docker image by extending the `lean` image. + +Here's an example Dockerfile that does this. Follow the in-line comments to customize it for +your desired Superset version and database drivers. The comments also note that a certain feature flag will +have to be enabled in your config file. + +You would build the image with `docker build -t mysuperset:latest .` or `docker build -t ourcompanysuperset:4.1.2 .` + +```Dockerfile +# change this to apache/superset:4.1.2 or whatever version you want to build from; +# otherwise the default is the latest commit on GitHub master branch +FROM apache/superset:master + +USER root + +# Set environment variable for Playwright +ENV PLAYWRIGHT_BROWSERS_PATH=/usr/local/share/playwright-browsers + +# Install packages using uv into the virtual environment +# Superset started using uv after the 4.1 branch; if you are building from apache/superset:4.1.x, +# replace the first two lines with RUN pip install \ +RUN . /app/.venv/bin/activate && \ + uv pip install \ + # install psycopg2 for using PostgreSQL metadata store - could be a MySQL package if using that backend: + psycopg2-binary \ + # add the driver(s) for your data warehouse(s), in this example we're showing for Microsoft SQL Server: + pymssql \ + # package needed for using single-sign on authentication: + Authlib \ + # install Playwright for taking screenshots for Alerts & Reports. This assumes the feature flag PLAYWRIGHT_REPORTS_AND_THUMBNAILS is enabled + # That feature flag will default to True starting in 6.0.0 + # Playwright works only with Chrome. + # If you are still using Selenium instead of Playwright, you would instead install here the selenium package and a headless browser & webdriver + playwright \ + && PLAYWRIGHT_BROWSERS_PATH=/usr/local/share/playwright-browsers playwright install chromium + +# Switch back to the superset user +USER superset + +CMD ["/app/docker/entrypoints/run-server.sh"] +``` + ## Key ARGs in Dockerfile - `BUILD_TRANSLATIONS`: whether to build the translations into the image. For the diff --git a/docs/docs/installation/installation-methods.mdx b/docs/docs/installation/installation-methods.mdx index 76a481938d1..51f3708b3ef 100644 --- a/docs/docs/installation/installation-methods.mdx +++ b/docs/docs/installation/installation-methods.mdx @@ -27,9 +27,7 @@ You will need to back up your metadata DB. That could mean backing up the servic You will also need to extend the Superset docker image. The default `lean` images do not contain drivers needed to access your metadata database (Postgres or MySQL), nor to access your data warehouse, nor the headless browser needed for Alerts & Reports. You could run a `-dev` image while demoing Superset, which has some of this, but you'll still need to install the driver for your data warehouse. The `-dev` images run as root, which is not recommended for production. -Ideally you will build your own image of Superset that extends `lean`, adding what your deployment needs. - -See [Docker Build Presets](/docs/installation/docker-builds/#build-presets) for more information about the different image versions you can extend. +Ideally you will build your own image of Superset that extends `lean`, adding what your deployment needs. See [Building your own production Docker image](/docs/installation/docker-builds/#building-your-own-production-docker-image). ## [Kubernetes (K8s)](/docs/installation/kubernetes.mdx)