fix: eprintln for Docker logs, include migrations in stub build
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -17,19 +17,21 @@ async fn main() {
|
|||||||
.await
|
.await
|
||||||
.expect("Failed to connect to database");
|
.expect("Failed to connect to database");
|
||||||
|
|
||||||
|
eprintln!("colony: connected to {}", db_url);
|
||||||
|
|
||||||
// Enable WAL mode
|
// Enable WAL mode
|
||||||
sqlx::query("PRAGMA journal_mode=WAL")
|
sqlx::query("PRAGMA journal_mode=WAL")
|
||||||
.execute(&pool)
|
.execute(&pool)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Run migrations using sqlx's proper migration system
|
// Run embedded migrations
|
||||||
sqlx::migrate!("./migrations")
|
sqlx::migrate!("./migrations")
|
||||||
.run(&pool)
|
.run(&pool)
|
||||||
.await
|
.await
|
||||||
.expect("Failed to run migrations");
|
.expect("Failed to run migrations");
|
||||||
|
|
||||||
println!("Colony running on port {}", port);
|
eprintln!("colony: migrations done, starting on port {}", port);
|
||||||
|
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
.route("/api/health", get(routes::health))
|
.route("/api/health", get(routes::health))
|
||||||
|
|||||||
@@ -11,15 +11,16 @@ FROM rust:1.86-slim AS backend
|
|||||||
RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Cache dependency build: copy manifests first, create stub sources, build deps
|
# Cache dependency build: copy manifests + migrations, create stub sources
|
||||||
COPY Cargo.toml Cargo.lock ./
|
COPY Cargo.toml Cargo.lock ./
|
||||||
COPY crates/colony-types/Cargo.toml crates/colony-types/Cargo.toml
|
COPY crates/colony-types/Cargo.toml crates/colony-types/Cargo.toml
|
||||||
COPY crates/colony/Cargo.toml crates/colony/Cargo.toml
|
COPY crates/colony/Cargo.toml crates/colony/Cargo.toml
|
||||||
|
COPY crates/colony/migrations crates/colony/migrations
|
||||||
RUN mkdir -p crates/colony-types/src crates/colony/src \
|
RUN mkdir -p crates/colony-types/src crates/colony/src \
|
||||||
&& echo "fn main() {}" > crates/colony/src/main.rs \
|
&& echo "fn main() {}" > crates/colony/src/main.rs \
|
||||||
&& echo "" > crates/colony-types/src/lib.rs \
|
&& echo "" > crates/colony-types/src/lib.rs \
|
||||||
&& cargo build --release -p colony 2>/dev/null || true \
|
&& cargo build --release -p colony 2>/dev/null || true \
|
||||||
&& rm -rf crates/
|
&& rm crates/colony/src/main.rs crates/colony-types/src/lib.rs
|
||||||
|
|
||||||
# Now copy real source and build (deps already cached)
|
# Now copy real source and build (deps already cached)
|
||||||
COPY crates/ crates/
|
COPY crates/ crates/
|
||||||
|
|||||||
Reference in New Issue
Block a user