From 1ab33eabc5e21044bf8d3c5ebb11c3a182008a59 Mon Sep 17 00:00:00 2001 From: arferreira Date: Wed, 18 Feb 2026 22:47:13 -0500 Subject: [PATCH] Add Railway deployment config --- Dockerfile | 23 ++++++++++++++++++++--- railway.toml | 8 ++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 railway.toml diff --git a/Dockerfile b/Dockerfile index e8b0848..5905025 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,33 @@ -FROM rust:1.85-slim AS builder +FROM rust:1.88-slim AS builder WORKDIR /app RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/* +# Install trunk and WASM target +RUN cargo install trunk --locked +RUN rustup target add wasm32-unknown-unknown + +# Cache dependencies COPY Cargo.toml Cargo.lock ./ +COPY crates/dashboard/Cargo.toml crates/dashboard/Cargo.toml RUN mkdir src && echo 'fn main() {}' > src/main.rs -RUN cargo build --release && rm -rf src +RUN mkdir -p crates/dashboard/src && echo '#[allow(dead_code)] fn main() {}' > crates/dashboard/src/lib.rs +RUN mkdir -p dist +RUN cargo build --release 2>/dev/null || true +RUN rm -rf src crates/dashboard/src dist +# Copy full source COPY src ./src -RUN touch src/main.rs && cargo build --release +COPY crates/dashboard ./crates/dashboard + +# Build dashboard WASM first +RUN cd crates/dashboard && trunk build --release + +# Build backend (embeds dist/ via rust-embed) +RUN cargo build --release +# Runtime FROM debian:bookworm-slim RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* diff --git a/railway.toml b/railway.toml new file mode 100644 index 0000000..41c4cea --- /dev/null +++ b/railway.toml @@ -0,0 +1,8 @@ +[build] +dockerfilePath = "Dockerfile" + +[deploy] +healthcheckPath = "/health" +healthcheckTimeout = 300 +restartPolicyType = "ON_FAILURE" +restartPolicyMaxRetries = 3