Bind mount the html files so they can be updated without stopping the server

This commit is contained in:
Brad Treloar 2025-02-03 23:26:39 +10:30
parent f41aa86cfa
commit 5dcb4d526b
3 changed files with 6 additions and 5 deletions

View file

@ -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

View file

@ -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
```

View file

@ -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