chore: add app service with cargo-watch

Spins up a container with Tranquil running, but automatically uses incremental rebuilds for local dev.

Signed-off-by: Trezy <tre@trezy.com>
This commit is contained in:
Trezy
2026-05-15 14:00:29 -05:00
committed by Tangled
parent 0afcb2ee28
commit 3fd8f7ebbf
3 changed files with 81 additions and 0 deletions

20
Dockerfile.dev Normal file
View File

@@ -0,0 +1,20 @@
FROM rust:1.92-alpine
RUN apk add --no-cache \
ca-certificates \
musl-dev \
pkgconfig \
openssl-dev \
openssl-libs-static \
mold \
clang \
protoc
RUN cargo install cargo-watch
ENV RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=mold"
ENV SQLX_OFFLINE=true
WORKDIR /app
CMD ["cargo", "watch", "-x", "run -p tranquil-server -- --config /app/config.dev.toml"]

30
config.dev.toml Normal file
View File

@@ -0,0 +1,30 @@
[server]
hostname = "pds.test"
allow_http_proxy = true
invite_code_required = false
disable_rate_limiting = true
[frontend]
enabled = true
dir = "/app/frontend/public"
[database]
url = "postgres://postgres:postgres@db:5432/pds"
[storage]
path = "/var/lib/tranquil-pds/blobs"
[plc]
directory_url = "http://plc:2582"
[email]
from_address = "noreply@pds.test"
from_name = "Tranquil PDS (Dev)"
[email.smarthost]
host = "mailpit"
port = 1025
tls = "none"
[secrets]
allow_insecure = true

View File

@@ -17,6 +17,35 @@ services:
db:
condition: service_healthy
app-dev:
profiles: [dev]
build:
context: .
dockerfile: Dockerfile.dev
command: >
sh -c '
cp /certs/pds.test.pem /usr/local/share/ca-certificates/pds.test.crt
update-ca-certificates
cargo watch -x "run -p tranquil-server --features native-tls-roots -- --config /app/config.dev.toml"
'
environment:
SERVER_HOST: "0.0.0.0"
SQLX_OFFLINE: "true"
PLC_DIRECTORY_URL: "http://plc:2582"
volumes:
- ./:/app
- cargo_target:/app/target
- cargo_registry:/usr/local/cargo/registry
- blob_data:/var/lib/tranquil-pds/blobs
- certs:/certs:ro
depends_on:
traefik:
condition: service_started
db:
condition: service_healthy
plc:
condition: service_started
frontend:
profiles: [prod]
build:
@@ -108,4 +137,6 @@ volumes:
blob_data:
store_data:
prometheus_data:
cargo_target:
cargo_registry:
certs: