Create Dockerfile for container image
As mentioned in https://github.com/chrieke/prettymapp/pull/27 my image is around 370 MB. Thanks to @sammcj here is my pull request. The dockerfile is from the offical streamlit docs https://docs.streamlit.io/knowledge-base/tutorials/deploy/docker.
Important: What i forgot to mention and just found testing it again, i had to fix the paths in streamlit-prettymap/app.py for the examples.json file and the example pictures directory. I didn't test if this destroys something when deploying directly to streamlit!
A fix to this could be to add another layer to the Dockerfile like this and ignore the directory fixes:
FROM python:3.10-slim
WORKDIR /app
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /app/streamlit-prettymap
COPY streamlit-prettymapp /app/streamlit-prettymap
RUN pip3 install -r requirements.txt
EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
ENTRYPOINT ["streamlit", "run", "streamlit-prettymap/app.py", "--server.port=8501", "--server.address=0.0.0.0"]
Let me know what you think. Hope this helps and will be merged :).
Hi @smilebasti Thank you very much for the contribution and sorry about the long awaited response.
I do prefer keeping the same folder structure as in the base repo, so I don't want to change the filepaths. I appreciate your suggestion for the alternative, made an alternative PR https://github.com/chrieke/prettymapp/pull/46 to showcase it. If you can maybe transfer these changes I'm happy to close mine and merge your PR!
However I encountered a bigger issue with installing fiona in Docker (regardless which Python base image 3.10slim or 3.11slim).
CRITICAL:root:A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
It's a pretty familiar issue to me, but I'm not sure why it comes up only in the docker setup, the base installations all work. The only thing that helps is the added libgdal installation, but that hugely blows up the Docker image to > 1.5GB.
Maybe I'm just missing something, could you have another look maybe?
@chrieke i must have missed your comment. I am still using the published version of prettymapp to build the image.
Please test the changes. The image should now be at 370 MB.
Great, thank you!