datasette icon indicating copy to clipboard operation
datasette copied to clipboard

Update Dockerfile generated by `datasette publish`

Open simonw opened this issue 4 years ago • 4 comments

The generated Dockerfile currently looks something like this:

FROM python:3.8
COPY . /app
WORKDIR /app

ENV DATASETTE_SECRET 'edab49cbc5d5f6f33238f54852037e3fee710821960b73edd2ce743454182ae2'
RUN pip install -U datasette datasette-auth-passwords datasette-tiddlywiki datasette-graphql
RUN datasette inspect fixtures.db other.db --inspect-file inspect-data.json
ENV PORT 8080
EXPOSE 8080
CMD datasette serve --host 0.0.0.0 -i fixtures.db -i other.db --cors --inspect-file inspect-data.json --metadata metadata.json --create --port $PORT /data/*.db

This is still on Python 3.8, and it generates a pretty large image compared to the Dockerfile used for https://hub.docker.com/datasetteproject/datasette - https://github.com/simonw/datasette/blob/0.60.2/Dockerfile

Here's the code that generates it: https://github.com/simonw/datasette/blob/7d24fd405f3c60e4c852c5d746c91aa2ba23cf5b/datasette/utils/init.py#L389-L400

simonw avatar Feb 11 '22 00:02 simonw

Starting it with FROM datasetteproject/datasette might be a good idea.

simonw avatar Feb 11 '22 00:02 simonw

Could also bump this up to Python 3.10: https://github.com/simonw/datasette/blob/5619069968ab39fd44c44a1888965e361c6f7fb9/Dockerfile#L1

simonw avatar Feb 11 '22 00:02 simonw

Looks like 3.10.2 is the latest: https://hub.docker.com/_/python?tab=tags&page=1&name=3.10.2-slim-bu

simonw avatar Feb 11 '22 00:02 simonw

I noticed the image was large when using fly. Is it possible to use a -slim base?

dholth avatar Mar 11 '22 17:03 dholth