Add Docker Compose deployment

compose.yaml runs playlistd with a Postgres database. Settings come from
.env (see .env.example), and Postgres must be healthy before playlistd
starts.

The Dockerfile builds the web UI with Node and the server with Rust, then
copies both into a Debian slim image that runs as an unprivileged user. It
also installs the latest yt-dlp (with its YouTube scripts) and Deno, the
JavaScript runtime yt-dlp needs for YouTube. playlistd's port is only
published on 127.0.0.1 by default, since it has no login.

The image can't reach a database during the build, so the SQL query data
from `cargo sqlx prepare` is now committed in .sqlx/. Builds with
DATABASE_URL set still check queries against that database.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018opPJMJjLWr4RqdG6vuK6p
This commit is contained in:
Claude committed 2026-11-14 10:22:23 +00:00
1 parent 77f9f29cc6
commit 0767c21a6f
42 files changed
+1633

No files matched your search

+29
View File
@@ -18,6 +18,35 @@ environment variables:
For deploying, these can be configured in `/etc/playlistd.toml`.
SQL queries are checked at compile time, against the database in `DATABASE_URL` if it's set, or
otherwise against the query data in `.sqlx/`. After changing a query, update that with
`cargo sqlx prepare` (from `cargo install sqlx-cli`) and commit it.
### Docker Compose
`compose.yaml` runs playlistd with its own Postgres database. The image includes the web UI,
yt-dlp and Deno (which yt-dlp needs for YouTube).
```sh
cp .env.example .env # then fill in your Subsonic server and a database password
docker compose up -d --build
```
The web UI is then at http://localhost:8000. playlistd has no login, so it only listens on the
Docker host by default; set `PLAYLISTD_BIND=0.0.0.0` in `.env` to open it to your network. If your
Subsonic server runs on the Docker host, use `http://host.docker.internal:4533/rest` as
`SUBSONIC_BASE`.
YouTube changes often break older yt-dlp versions, and the image installs the latest one when it's
built, so rebuild it now and then to keep new songs playing:
```sh
docker compose build --pull && docker compose up -d
```
With podman, use `podman compose`, or build the image with `podman build -f Dockerfile .`: on its
own, `podman build` picks `Containerfile`, which builds the `.deb` below.
### Container build (Ubuntu 22.04)
Build the image: