Dockerfile 613 B

1234567891011121314151617181920212223242526272829303132333435
  1. FROM jdrouet/rust-nightly:buster-slim AS base
  2. RUN apt-get update \
  3. && apt-get install -y libpq-dev \
  4. && rm -rf /var/lib/apt/lists/*
  5. ENV USER=root
  6. ENV ROCKET_ADDRESS=0.0.0.0
  7. ENV ROCKET_ENV=development
  8. WORKDIR /code
  9. RUN cargo init
  10. COPY Cargo.toml /code/Cargo.toml
  11. RUN cargo fetch
  12. COPY . /code
  13. FROM base AS development
  14. EXPOSE 8000
  15. CMD [ "cargo", "run", "--offline" ]
  16. FROM base AS builder
  17. RUN cargo build --release --offline
  18. FROM debian:buster-slim
  19. ENV ROCKET_ENV=production
  20. EXPOSE 8000
  21. COPY --from=builder /code/target/release/react-rust-postgres /react-rust-postgres
  22. CMD [ "/react-rust-postgres" ]