Skip to content

Commit

Permalink
fix: docker api build
Browse files Browse the repository at this point in the history
  • Loading branch information
piny4man committed Jul 7, 2024
1 parent 4a78226 commit 4cfb6d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
5 changes: 4 additions & 1 deletion api/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ async fn calculate_results(competitor_info: Json<CompetitorInfo>) -> Result<Json

#[actix_web::main]
async fn main() -> std::io::Result<()> {
let address = "127.0.0.1:8080";
println!("Starting server to {address}");

HttpServer::new(|| {
App::new()
.service(
Expand All @@ -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
}

0 comments on commit 4cfb6d6

Please sign in to comment.