Skip to content

Commit 6fe0415

Browse files
authored
Add Railway deployment config (#7)
## Summary - Multi-stage Dockerfile that builds the dashboard WASM (trunk) before compiling the backend binary (rust-embed bakes dist/ into the binary) - Rust version bumped from 1.85 to 1.88 to match CI - New railway.toml for Dockerfile-based builds with health checks on /health ## Manual steps after merge 1. Create Railway project, add PostgreSQL addon 2. Connect zaptech-dev/reeverb repo (main branch) 3. Set env vars: JWT_SECRET, RUST_LOG=info, PORT=3000 4. DATABASE_URL auto-injected from Postgres addon ## Test plan - [ ] `docker build -t reeverb .` builds successfully - [ ] Container starts, /health returns 200 - [ ] Railway deploys on push to main
1 parent 6b39708 commit 6fe0415

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

Dockerfile

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,33 @@
1-
FROM rust:1.85-slim AS builder
1+
FROM rust:1.88-slim AS builder
22

33
WORKDIR /app
44

55
RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
66

7+
# Install trunk and WASM target
8+
RUN cargo install trunk --locked
9+
RUN rustup target add wasm32-unknown-unknown
10+
11+
# Cache dependencies
712
COPY Cargo.toml Cargo.lock ./
13+
COPY crates/dashboard/Cargo.toml crates/dashboard/Cargo.toml
814
RUN mkdir src && echo 'fn main() {}' > src/main.rs
9-
RUN cargo build --release && rm -rf src
15+
RUN mkdir -p crates/dashboard/src && echo '#[allow(dead_code)] fn main() {}' > crates/dashboard/src/lib.rs
16+
RUN mkdir -p dist
17+
RUN cargo build --release 2>/dev/null || true
18+
RUN rm -rf src crates/dashboard/src dist
1019

20+
# Copy full source
1121
COPY src ./src
12-
RUN touch src/main.rs && cargo build --release
22+
COPY crates/dashboard ./crates/dashboard
23+
24+
# Build dashboard WASM first
25+
RUN cd crates/dashboard && trunk build --release
26+
27+
# Build backend (embeds dist/ via rust-embed)
28+
RUN cargo build --release
1329

30+
# Runtime
1431
FROM debian:bookworm-slim
1532

1633
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*

railway.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[build]
2+
dockerfilePath = "Dockerfile"
3+
4+
[deploy]
5+
healthcheckPath = "/health"
6+
healthcheckTimeout = 300
7+
restartPolicyType = "ON_FAILURE"
8+
restartPolicyMaxRetries = 3

0 commit comments

Comments
 (0)