docker sht
All checks were successful
Build and Push Docker Image / build_and_push (push) Successful in 1m7s

This commit is contained in:
Mohamad 2025-01-03 13:45:35 +01:00
parent 9aeea66f22
commit 5eb085067d
2 changed files with 5 additions and 5 deletions

View File

@ -11,10 +11,10 @@ WORKDIR /app/backend
COPY backend/ . COPY backend/ .
RUN cargo build --release RUN cargo build --release
# Final Stage: Combine frontend and backend # Final Stage
FROM debian:bullseye-slim FROM debian:bullseye-slim
WORKDIR /app WORKDIR /app
COPY --from=frontend-builder /app/frontend/build ./frontend/dist COPY --from=frontend-builder /app/frontend/build ./frontend/build
COPY --from=backend-builder /app/backend/target/release/formies_be ./formies_be COPY --from=backend-builder /app/backend/target/release/formies_be ./formies_be
EXPOSE 8080 EXPOSE 8080
CMD ["./backend"] CMD ["./formies_be"]

View File

@ -24,7 +24,7 @@ async fn main() -> std::io::Result<()> {
.allow_any_method(), .allow_any_method(),
) )
.app_data(web::Data::new(db.clone())) .app_data(web::Data::new(db.clone()))
.service(fs::Files::new("/", "./frontend/dist").index_file("index.html")) .service(fs::Files::new("/", "frontend/build").index_file("index.html"))
.route("/login", web::post().to(handlers::login)) // Public: Login .route("/login", web::post().to(handlers::login)) // Public: Login
.route( .route(
"/forms/{id}/submissions", "/forms/{id}/submissions",
@ -37,7 +37,7 @@ async fn main() -> std::io::Result<()> {
web::get().to(handlers::get_submissions), // Protected web::get().to(handlers::get_submissions), // Protected
) )
}) })
.bind("127.0.0.1:8080")? .bind("0.0.0.0:8080")?
.run() .run()
.await .await
} }