From 9e45e8544aaab75f8ad31285295ff4fd6726ff09 Mon Sep 17 00:00:00 2001 From: Ben Sturmfels Date: Thu, 26 Oct 2023 12:31:52 +1100 Subject: [PATCH] Update and document Dockerfile --- Dockerfile-debian-bookworm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Dockerfile-debian-bookworm b/Dockerfile-debian-bookworm index cc32d58e..d68c174d 100644 --- a/Dockerfile-debian-bookworm +++ b/Dockerfile-debian-bookworm @@ -1,5 +1,13 @@ -# docker build --tag sfconservancy.org-bookworm - < Dockerfile-debian-bookworm -# docker run --tty --interactive --rm=true --publish=8000:8000 --mount type=bind,source=$(pwd),target=/var/www/website --mount type=bind,source=$(pwd)/conservancy-website.sqlite3,target=/var/lib/www/database/conservancy-website.sqlite3 sfconservancy.org-bookworm:latest +# To build the Docker image with the necessary dependencies: +# docker build --tag sfconservancy.org-bookworm --file Dockerfile-debian-bookworm . +# +# To run the website, first ensure you have a +# "conservancy/djangocommonsettings.py" file, with an appropriate database path. Then run: +# +# run --tty --interactive --rm=true --publish=8000:8000 \ +# --mount type=bind,source=$(pwd),target=/var/www/website \ +# --mount type=bind,source=$(pwd)/conservancy-website.sqlite3,target=/var/lib/www/database/conservancy-website.sqlite3 \ +# sfconservancy.org-bookworm:latest ARG DEBIAN_FRONTEND=noninteractive @@ -7,6 +15,8 @@ FROM debian:bookworm RUN apt-get update && apt-get upgrade -y RUN apt-get install -y python3 python3-pip python3-wheel sqlite3 RUN apt-get install -y python3-django python3-bs4 python3-html5lib python3-django-countries +COPY ./requirements.txt /var/www/website/requirements.txt +WORKDIR /var/www/website/ +RUN python3 -m pip install -r requirements.txt --break-system-packages RUN python3 -m pip freeze -WORKDIR /var/www/website/www -ENTRYPOINT ["python3", "/var/www/website/www/manage.py", "runserver", "0.0.0.0:8000"] +ENTRYPOINT ["python3", "/var/www/website/manage.py", "runserver", "0.0.0.0:8000"]