Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfile generated by datasette publish #1634

Open
simonw opened this issue Feb 11, 2022 · 4 comments
Open

Update Dockerfile generated by datasette publish #1634

simonw opened this issue Feb 11, 2022 · 4 comments
Labels
datasette-publish docker The official Docker image, plus other things related to running Datasette on Docker
Milestone

Comments

@simonw
Copy link
Owner

simonw commented Feb 11, 2022

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:

return """
FROM python:3.8
COPY . /app
WORKDIR /app
{apt_get_extras}
{environment_variables}
RUN pip install -U {install_from}
RUN datasette inspect {files} --inspect-file inspect-data.json
ENV PORT {port}
EXPOSE {port}
CMD {cmd}""".format(
apt_get_extras=APT_GET_DOCKERFILE_EXTRAS.format(" ".join(apt_get_extras))

@simonw simonw added datasette-publish docker The official Docker image, plus other things related to running Datasette on Docker labels Feb 11, 2022
@simonw simonw added this to the Datasette 1.0 milestone Feb 11, 2022
@simonw
Copy link
Owner Author

simonw commented Feb 11, 2022

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

@simonw
Copy link
Owner Author

simonw commented Feb 11, 2022

Could also bump this up to Python 3.10:

FROM python:3.9.7-slim-bullseye as build

@simonw
Copy link
Owner Author

simonw commented Feb 11, 2022

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

@dholth
Copy link

dholth commented Mar 11, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datasette-publish docker The official Docker image, plus other things related to running Datasette on Docker
Projects
None yet
Development

No branches or pull requests

2 participants