Convert to docker compose
This commit is contained in:
parent
82348ddc7c
commit
86fc7ca259
5 changed files with 22 additions and 48 deletions
23
README.md
23
README.md
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## Set up hugo and build HTML
|
## Set up hugo and build HTML
|
||||||
|
|
||||||
````bash
|
```bash
|
||||||
# Install hugo.
|
# Install hugo.
|
||||||
sudo apt install hugo
|
sudo apt install hugo
|
||||||
|
|
||||||
|
|
@ -11,27 +11,22 @@ cd hugo
|
||||||
hugo
|
hugo
|
||||||
```
|
```
|
||||||
|
|
||||||
## Build and run server
|
## Prepare and run server
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Set access credentials.
|
# Set access credentials.
|
||||||
./passwd.sh username password
|
./passwd.sh username password
|
||||||
|
|
||||||
# Build/rebuild the image.
|
# Run the service.
|
||||||
docker build --no-cache -t notes-server .
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
# Run the image, listening on port 42069.
|
## Changing the login credentials
|
||||||
docker run -d \
|
|
||||||
--name notes-server \
|
|
||||||
-v "/var/www/html/notes/hugo/public:/usr/share/nginx/html" \
|
|
||||||
-p 42069:80 \
|
|
||||||
notes-server
|
|
||||||
````
|
|
||||||
|
|
||||||
## Auth credentials setup
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Overwrite the htpasswd file with new user credentials.
|
# Overwrite the htpasswd file with new user credentials.
|
||||||
# (Rebuild the image to copy the new credentials.)
|
|
||||||
./passwd.sh username password
|
./passwd.sh username password
|
||||||
|
|
||||||
|
# (Rebuild the image to copy the new credentials.)
|
||||||
|
docker compose down && docker compose up -d --build
|
||||||
```
|
```
|
||||||
|
|
|
||||||
13
docker-compose.yml
Normal file
13
docker-compose.yml
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
services:
|
||||||
|
server:
|
||||||
|
build:
|
||||||
|
context: docker
|
||||||
|
dockerfile: ./docker/Dockerfile
|
||||||
|
container_name: server
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- ./hugo/public:/usr/share/nginx/html:ro
|
||||||
|
ports:
|
||||||
|
- "42069:80"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
docker container rm notes-server
|
|
||||||
docker build --no-cache -t notes-server .
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Remove the existing container
|
|
||||||
systemctl stop notes.service
|
|
||||||
systemctl disable notes.service
|
|
||||||
docker container stop notes-server
|
|
||||||
docker container rm notes-server
|
|
||||||
|
|
||||||
# Build the notes-server image.
|
|
||||||
docker build --no-cache -t notes-server .
|
|
||||||
|
|
||||||
# Run the notes-server image.
|
|
||||||
docker run -d \
|
|
||||||
--name notes-server \
|
|
||||||
-v "${PWD}/../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
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Run the notes-server image.
|
|
||||||
docker run \
|
|
||||||
--name notes-server \
|
|
||||||
-v "${PWD}/../hugo/public:/usr/share/nginx/html" \
|
|
||||||
-p 42069:80 \
|
|
||||||
notes-server
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue