Dockerfile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. FROM rust:latest
  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. RUN apt-get update -y \
  7. && apt-get install -y --no-install-recommends git \
  8. # Clean up
  9. && apt-get autoremove -y \
  10. && apt-get clean -y \
  11. && rm -rf /var/lib/apt/lists/*
  12. RUN git clone https://github.com/AppFlowy-IO/appflowy.git .
  13. WORKDIR /app/backend
  14. ENV SQLX_OFFLINE true
  15. ENV APP_ENVIRONMENT production
  16. RUN RUSTFLAGS="-C opt-level=2" cargo build --release
  17. # When `docker run` is executed, launch the binary!
  18. ENTRYPOINT ["./target/release/backend"]
  19. #
  20. ## We use the latest Rust stable release as base image
  21. #FROM lukemathwalker/cargo-chef:latest-rust-1.53.0 as planner
  22. #WORKDIR /app
  23. #COPY . .
  24. #
  25. #WORKDIR /app/backend
  26. #RUN cargo chef prepare --recipe-path recipe.json
  27. #
  28. #FROM lukemathwalker/cargo-chef:latest-rust-1.53.0 as cacher
  29. #WORKDIR /app/backend
  30. #COPY --from=planner /app/backend/recipe.json recipe.json
  31. ## Build our project dependencies, not our application!
  32. #RUN cargo chef cook --release --recipe-path recipe.json
  33. #
  34. #FROM rust:1.53.0 AS builder
  35. #WORKDIR /app/backend
  36. ## Copy over the cached dependencies
  37. #COPY --from=cacher /app/backend/target target
  38. #COPY --from=cacher /usr/local/cargo /usr/local/cargo
  39. #COPY . .
  40. #
  41. #ENV SQLX_OFFLINE true
  42. #RUN cargo build --release --bin backend
  43. #
  44. #
  45. #FROM debian:buster-slim AS runtime
  46. #WORKDIR /app/backend
  47. #RUN apt-get update -y \
  48. # && apt-get install -y --no-install-recommends openssl \
  49. # # Clean up
  50. # && apt-get autoremove -y \
  51. # && apt-get clean -y \
  52. # && rm -rf /var/lib/apt/lists/*
  53. #COPY --from=builder /app/backend/target/release/backend backend
  54. ##COPY configuration configuration
  55. #ENV APP_ENVIRONMENT production
  56. #ENTRYPOINT ["./backend"]