Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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/*
Expand Down
8 changes: 8 additions & 0 deletions railway.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[build]
dockerfilePath = "Dockerfile"

[deploy]
healthcheckPath = "/health"
healthcheckTimeout = 300
restartPolicyType = "ON_FAILURE"
restartPolicyMaxRetries = 3