datasette
datasette copied to clipboard
Switch to more recent, smaller Docker image
For the package published to Docker Hub and also the containers used by datasette package and datasette publish cloudrun.
Relevant Twitter thread: https://twitter.com/simonw/status/1544710944462254080
Looks like python:3.10-slim-bullseye is a good option, see https://pythonspeed.com/articles/base-image-python-docker-images/
I tried this on Datasette Cloud and swapping datasetteproject/datasette to python:3.10-slim-bullseye as the base image dropped the overall image size from ~232MB to ~166MB - but note that I don't have SpatiaLite in that second image.
https://hub.docker.com/layers/python/library/python/3.10.6-slim-bullseye/images/sha256-cf85cd32e60184a94d88a0103c289d09024abffaa77680d116d7cc837668ea15?context=explore is the most recent - 3.10.6-slim-bullseye.
Tested locally with:
datasette package fixtures.db --extra-options="--setting sql_time_limit_ms 2500" \
-t datasette-package-python-upgrade
And then:
docker run -p 8081:8001 datasette-package-python-upgrade
INFO: Started server process [8]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8001 (Press CTRL+C to quit)
Also trying this locally:
datasette publish cloudrun fixtures.db --service issue-1768
https://issue-1768-j7hipcg4aq-uc.a.run.app/-/versions