Move docker files into subdir

This commit is contained in:
Brad Treloar 2025-04-16 00:01:51 +09:30
parent 600cbc626f
commit 246317d84f
5 changed files with 0 additions and 2 deletions

9
docker/Dockerfile Normal file
View file

@ -0,0 +1,9 @@
FROM nginx:alpine
# Replace default config.
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/auth.conf
# Add user credentials.
COPY nginx.htpasswd /etc/nginx/auth.htpasswd

15
docker/install.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash
# Build the notes-server image.
docker build --no-cache -t notes-server .
# Run the notes-server image.
docker run -d \
--name notes-server \
-v "/var/www/html/notes/hugo/public:/usr/share/nginx/html" \
-p 42069:80 \
notes-server
# Install and enable the systemctl service.
cp notes.service /etc/systemd/system/notes.service
systemctl enable notes.service

9
docker/nginx.conf Normal file
View file

@ -0,0 +1,9 @@
server {
listen 80 default_server;
root "/usr/share/nginx/html";
location / {
auth_basic "Restricted";
auth_basic_user_file auth.htpasswd;
}
}

13
docker/notes.service Normal file
View file

@ -0,0 +1,13 @@
[Unit]
Description=Notes server
After=docker.service
Wants=network-online.target docker.socket
Requires=docker.socket
[Service]
ExecStart=/usr/bin/docker start -a notes-server
ExecStop=/usr/bin/docker stop -t 10 notes-server
Restart=always
[Install]
WantedBy=multi-user.target

4
docker/passwd.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
# htpasswd from package apache2-utils
htpasswd -nb $1 $2 > nginx.htpasswd