4
0

Dockerfile 501 B

12345678910111213141516171819202122232425262728293031
  1. FROM rust:buster AS base
  2. ENV USER=root
  3. ENV ROCKET_ADDRESS=0.0.0.0
  4. ENV ROCKET_ENV=development
  5. WORKDIR /code
  6. RUN cargo init
  7. COPY Cargo.toml /code/Cargo.toml
  8. RUN cargo fetch
  9. COPY . /code
  10. FROM base AS development
  11. EXPOSE 8000
  12. CMD [ "cargo", "run", "--offline" ]
  13. FROM base AS builder
  14. RUN cargo build --release --offline
  15. FROM debian:buster-slim
  16. ENV ROCKET_ENV=production
  17. EXPOSE 8000
  18. COPY --from=builder /code/target/release/react-rust-postgres /react-rust-postgres
  19. CMD [ "/react-rust-postgres" ]