datasette icon indicating copy to clipboard operation
datasette copied to clipboard

Switch to more recent, smaller Docker image

Open simonw opened this issue 3 years ago • 2 comments

For the package published to Docker Hub and also the containers used by datasette package and datasette publish cloudrun.

simonw avatar Jul 06 '22 18:07 simonw

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/

simonw avatar Jul 06 '22 18:07 simonw

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.

simonw avatar Jul 07 '22 17:07 simonw

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.

simonw avatar Aug 14 '22 15:08 simonw

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)
image

simonw avatar Aug 14 '22 15:08 simonw

Also trying this locally:

datasette publish cloudrun fixtures.db --service issue-1768

https://issue-1768-j7hipcg4aq-uc.a.run.app/-/versions

image

simonw avatar Aug 14 '22 15:08 simonw