From 5dcb4d526bbf8317f1d037731b8777c208055b1c Mon Sep 17 00:00:00 2001 From: Brad Treloar Date: Mon, 3 Feb 2025 23:26:39 +1030 Subject: [PATCH] Bind mount the html files so they can be updated without stopping the server --- Dockerfile | 2 +- README.md | 7 ++++--- redeploy.sh | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index e051d7d..61c57b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,4 +8,4 @@ COPY nginx.conf /etc/nginx/conf.d/auth.conf COPY nginx.htpasswd /etc/nginx/auth.htpasswd # Copy the HTML files. -COPY ./site /usr/share/nginx/html +#COPY ./site /usr/share/nginx/html diff --git a/README.md b/README.md index 746e051..0efcb9d 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,14 @@ # Build/rebuild the image. docker build --no-cache -t notes-server . -# Run the image, listening on port 8080. -docker run -p 42069:80 -t notes-server +# Run the image, listening on port 42069. +docker run --mount type=bind,src=./site,dst=/usr/share/nginx/html -p 42069:80 -t notes-server ``` ## Auth credentials setup ```bash # Overwrite the htpasswd file with new user credentials. -htpasswd -nb username password > auth.htpasswd +# (Rebuild the image to copy the new credentials.) +./passwd.sh username password ``` diff --git a/redeploy.sh b/redeploy.sh index ee7d8a5..da3ee7d 100755 --- a/redeploy.sh +++ b/redeploy.sh @@ -4,4 +4,4 @@ docker build --no-cache -t notes-server . # Run the image, listening on port 8080. -docker run -p 42069:80 -t notes-server +docker run --mount type=bind,src=./site,dst=/usr/share/nginx/html -p 42069:80 -t notes-server