From df929690cc0046293f02b67ae56311df6a36a11d Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Sun, 14 Sep 2025 14:11:14 +0200 Subject: [PATCH] Teach deploystatic docker container to also act as a server If wanted, for those that don't have access to a local webserver (!), this is an easy way to preview a static site. --- tools/deploystatic/Dockerfile | 6 +++--- tools/deploystatic/README.docker | 13 +++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/deploystatic/Dockerfile b/tools/deploystatic/Dockerfile index b732b98e..855e7f38 100644 --- a/tools/deploystatic/Dockerfile +++ b/tools/deploystatic/Dockerfile @@ -1,6 +1,6 @@ FROM debian:bullseye RUN apt-get -y update && apt-get -y upgrade && apt-get -y install python3-jinja2 python3-markdown python3-dateutil && apt-get -y clean RUN mkdir /source /target -ADD deploystatic.py / -ENTRYPOINT ["/deploystatic.py"] -CMD ["/source", "/target"] \ No newline at end of file +ADD deploystatic.py entrypoint.sh / +EXPOSE 9099 +ENTRYPOINT ["/entrypoint.sh"] diff --git a/tools/deploystatic/README.docker b/tools/deploystatic/README.docker index 3f81d067..ed6ecc23 100644 --- a/tools/deploystatic/README.docker +++ b/tools/deploystatic/README.docker @@ -5,11 +5,20 @@ example: docker build -t deploystatic . -And then to use it: +To use this container to deploy to a static directory, use: docker run -it --rm -v `pwd`:/source -v /tmp/statictest:/target deploystatic (In this case taking the templates in the current directory and deploying the result to /tmp/statictest - adjust for your own directories) -You can also just specify the default parameters as docker arguments. \ No newline at end of file +You can also just specify the default parameters as docker arguments. + + +You can also use the docker container to run a simple static webserver with +the output of the static directory like this: + +docker run -it --rm -v `pwd`:/source -p 9099:9099 deploystatic -serve + +This will deploy the current directory inside the container and start a webserver +on port 9099. \ No newline at end of file -- 2.39.5