diff --git a/Dockerfile b/Dockerfile index 6c34ba2..b79c6e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,9 +11,10 @@ COPY --from=planner /app/recipe.json recipe.json RUN cargo chef cook --release --recipe-path recipe.json # Build application COPY . . -RUN cargo build --release --bin api +RUN cargo build --release --manifest-path api/Cargo.toml FROM debian:bookworm-slim AS runtime WORKDIR /app COPY --from=builder /app/target/release/api /usr/local/bin +EXPOSE 8080 ENTRYPOINT ["/usr/local/bin/api"] diff --git a/api/src/main.rs b/api/src/main.rs index b10350b..bbbcd6b 100644 --- a/api/src/main.rs +++ b/api/src/main.rs @@ -18,6 +18,9 @@ async fn calculate_results(competitor_info: Json) -> Result std::io::Result<()> { + let address = "127.0.0.1:8080"; + println!("Starting server to {address}"); + HttpServer::new(|| { App::new() .service( @@ -27,7 +30,7 @@ async fn main() -> std::io::Result<()> { ) .service(Files::new("/", "../static").index_file("index.html")) }) - .bind("127.0.0.1:8080")? + .bind(address)? .run() .await }