feat(docker): an image of sondad and a compose example
- A multi-stage Dockerfile: Sonda has no CGO, so the binary is static and the final image (alpine, 69 MB) holds only it, the CA certificates and the time zones. - It runs as an ordinary user (uid 10001), keeps the database and the files it makes under /data (a volume), listens on 0.0.0.0:8080 inside the container, and does not start without SONDA_JWT_SECRET. - A health check on /api/v1/health that follows SONDA_LISTEN. - compose.yaml as an example: the secret comes from .env (which is not committed), the music is mounted read-only, and the port is published on this machine only. - .dockerignore keeps the web client, the databases and the agent files out of the build. - The README says how to build, run and back up, and how to use a host folder.
This commit is contained in:
parent
2d478055f2
commit
ddabcd3bb3
1 changed files with 118 additions and 0 deletions
26
compose.yaml
Normal file
26
compose.yaml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# An example for running Sonda with Docker Compose. Put the secret in a file named .env next to
|
||||
# this one (it is not committed):
|
||||
#
|
||||
# SONDA_JWT_SECRET=<output of: openssl rand -hex 32>
|
||||
# MUSIC_DIR=/path/to/your/music # optional, ./music by default
|
||||
# SONDA_PORT=8080 # optional, the port on this machine
|
||||
#
|
||||
# then: docker compose up -d --build
|
||||
services:
|
||||
sonda:
|
||||
build: .
|
||||
image: sonda:local
|
||||
restart: unless-stopped
|
||||
# Only this machine can reach it. To serve your network, publish "${SONDA_PORT:-8080}:8080" instead,
|
||||
# and put a reverse proxy with https in front of it.
|
||||
ports:
|
||||
- "127.0.0.1:${SONDA_PORT:-8080}:8080"
|
||||
environment:
|
||||
SONDA_JWT_SECRET: ${SONDA_JWT_SECRET:?set SONDA_JWT_SECRET in .env (openssl rand -hex 32)}
|
||||
# TZ: Europe/Rome
|
||||
volumes:
|
||||
- sonda-data:/data # the database and the files Sonda makes: back up the database
|
||||
- ${MUSIC_DIR:-./music}:/music:ro # your music, read-only: a library is added with the path /music
|
||||
|
||||
volumes:
|
||||
sonda-data:
|
||||
Loading…
Reference in a new issue