Added docker/compose stuff and hopefully fixed CI
Some checks failed
CI / check (push) Failing after 12s
Some checks failed
CI / check (push) Failing after 12s
This commit is contained in:
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
target/
|
||||||
|
shanty-web/static/
|
||||||
|
shanty-web/frontend/dist/
|
||||||
|
.git/
|
||||||
@@ -6,9 +6,12 @@ jobs:
|
|||||||
check:
|
check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- run: git config --global url."https://git.rcjohnstone.com/".insteadOf "ssh://connor@git.rcjohnstone.com:2222/"
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
token: ${{ secrets.GITEA }}
|
||||||
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
|
|||||||
44
Dockerfile
Normal file
44
Dockerfile
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# Stage 1: Build frontend (Yew/WASM)
|
||||||
|
FROM rust:1-bookworm AS frontend
|
||||||
|
RUN rustup target add wasm32-unknown-unknown \
|
||||||
|
&& cargo install trunk
|
||||||
|
WORKDIR /build
|
||||||
|
COPY . .
|
||||||
|
RUN rustup target list --installed && cd shanty-web/frontend && trunk build --release
|
||||||
|
|
||||||
|
# Stage 2: Build backend
|
||||||
|
FROM rust:1-bookworm AS backend
|
||||||
|
WORKDIR /build
|
||||||
|
COPY . .
|
||||||
|
COPY --from=frontend /build/shanty-web/static ./shanty-web/static
|
||||||
|
RUN cargo build --release --bin shanty
|
||||||
|
|
||||||
|
# Stage 3: Runtime
|
||||||
|
FROM debian:bookworm-slim
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
ca-certificates ffmpeg python3 python3-pip python3-venv \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN python3 -m venv /opt/venv \
|
||||||
|
&& /opt/venv/bin/pip install --no-cache-dir ytmusicapi yt-dlp
|
||||||
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=backend /build/target/release/shanty .
|
||||||
|
COPY --from=backend /build/shanty-web/static ./static
|
||||||
|
COPY --from=backend /build/shanty-dl/scripts/ytmusic_search.py /usr/share/shanty/
|
||||||
|
|
||||||
|
RUN mkdir -p /config /data /music
|
||||||
|
|
||||||
|
ENV SHANTY_CONFIG=/config/config.yaml
|
||||||
|
ENV SHANTY_DATABASE_URL=sqlite:///data/shanty.db?mode=rwc
|
||||||
|
ENV SHANTY_LIBRARY_PATH=/music
|
||||||
|
ENV SHANTY_DOWNLOAD_PATH=/data/downloads
|
||||||
|
|
||||||
|
EXPOSE 8085
|
||||||
|
|
||||||
|
VOLUME ["/config", "/data", "/music"]
|
||||||
|
|
||||||
|
CMD ["./shanty"]
|
||||||
15
compose.yml
Normal file
15
compose.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
services:
|
||||||
|
shanty:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "8085:8085"
|
||||||
|
volumes:
|
||||||
|
- ./config:/config
|
||||||
|
- shanty-data:/data
|
||||||
|
- /path/to/music:/music # Change this to your music library path
|
||||||
|
environment:
|
||||||
|
- SHANTY_WEB_BIND=0.0.0.0
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
shanty-data:
|
||||||
41
readme.md
41
readme.md
@@ -121,6 +121,47 @@ download:
|
|||||||
# cookies_path: ~/.config/shanty/cookies.txt # for higher YT rate limits
|
# cookies_path: ~/.config/shanty/cookies.txt # for higher YT rate limits
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
|
||||||
|
### Quick start
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Edit compose.yml to set your music library path, then:
|
||||||
|
docker compose up -d
|
||||||
|
# Open http://localhost:8085
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build from source
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -t shanty .
|
||||||
|
docker run -d \
|
||||||
|
-p 8085:8085 \
|
||||||
|
-v ./config:/config \
|
||||||
|
-v shanty-data:/data \
|
||||||
|
-v /path/to/music:/music \
|
||||||
|
shanty
|
||||||
|
```
|
||||||
|
|
||||||
|
### Volumes
|
||||||
|
|
||||||
|
| Mount | Purpose |
|
||||||
|
|-------|---------|
|
||||||
|
| `/config` | Config file (`config.yaml`) |
|
||||||
|
| `/data` | Database (`shanty.db`) and downloads |
|
||||||
|
| `/music` | Your music library |
|
||||||
|
|
||||||
|
### Environment variables
|
||||||
|
|
||||||
|
| Variable | Default | Description |
|
||||||
|
|----------|---------|-------------|
|
||||||
|
| `SHANTY_CONFIG` | `/config/config.yaml` | Config file path |
|
||||||
|
| `SHANTY_DATABASE_URL` | `sqlite:///data/shanty.db?mode=rwc` | Database URL |
|
||||||
|
| `SHANTY_LIBRARY_PATH` | `/music` | Music library path |
|
||||||
|
| `SHANTY_DOWNLOAD_PATH` | `/data/downloads` | Download directory |
|
||||||
|
| `SHANTY_WEB_PORT` | `8085` | HTTP port |
|
||||||
|
| `SHANTY_WEB_BIND` | `0.0.0.0` | Bind address |
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "stable"
|
channel = "stable"
|
||||||
|
targets = ["wasm32-unknown-unknown"]
|
||||||
|
|||||||
Reference in New Issue
Block a user