Dockerfile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. FROM rust:1.56.1
  2. # Let's switch our working directory to `app` (equivalent to `cd app`)
  3. # The `app` folder will be created for us by Docker in case it does not
  4. # exist already.
  5. WORKDIR /app
  6. COPY . .
  7. WORKDIR /app/backend
  8. ENV SQLX_OFFLINE true
  9. ENV APP_ENVIRONMENT production
  10. RUN RUSTFLAGS="-C opt-level=2" cargo build --release
  11. # When `docker run` is executed, launch the binary!
  12. ENTRYPOINT ["./target/release/backend"]
  13. #
  14. ## We use the latest Rust stable release as base image
  15. #FROM lukemathwalker/cargo-chef:latest-rust-1.53.0 as planner
  16. #WORKDIR /app
  17. #COPY . .
  18. #
  19. #WORKDIR /app/backend
  20. #RUN cargo chef prepare --recipe-path recipe.json
  21. #
  22. #FROM lukemathwalker/cargo-chef:latest-rust-1.53.0 as cacher
  23. #WORKDIR /app/backend
  24. #COPY --from=planner /app/backend/recipe.json recipe.json
  25. ## Build our project dependencies, not our application!
  26. #RUN cargo chef cook --release --recipe-path recipe.json
  27. #
  28. #FROM rust:1.53.0 AS builder
  29. #WORKDIR /app/backend
  30. ## Copy over the cached dependencies
  31. #COPY --from=cacher /app/backend/target target
  32. #COPY --from=cacher /usr/local/cargo /usr/local/cargo
  33. #COPY . .
  34. #
  35. #ENV SQLX_OFFLINE true
  36. #RUN cargo build --release --bin backend
  37. #
  38. #
  39. #FROM debian:buster-slim AS runtime
  40. #WORKDIR /app/backend
  41. #RUN apt-get update -y \
  42. # && apt-get install -y --no-install-recommends openssl \
  43. # # Clean up
  44. # && apt-get autoremove -y \
  45. # && apt-get clean -y \
  46. # && rm -rf /var/lib/apt/lists/*
  47. #COPY --from=builder /app/backend/target/release/backend backend
  48. ##COPY configuration configuration
  49. #ENV APP_ENVIRONMENT production
  50. #ENTRYPOINT ["./backend"]