Dockerfile 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. FROM rust:latest AS builder
  2. RUN update-ca-certificates
  3. # Create appuser
  4. ENV USER=kinbrio
  5. ENV UID=10001
  6. RUN adduser \
  7. --disabled-password \
  8. --gecos "" \
  9. --home "/nonexistent" \
  10. --shell "/sbin/nologin" \
  11. --no-create-home \
  12. --uid "${UID}" \
  13. "${USER}"
  14. WORKDIR /kinbrio
  15. COPY ./ .
  16. # We no longer need to use the x86_64-unknown-linux-musl target
  17. RUN cargo build --release
  18. ####################################################################################################
  19. ## Final image
  20. ####################################################################################################
  21. FROM debian:buster-slim
  22. # Import from builder.
  23. COPY --from=builder /etc/passwd /etc/passwd
  24. COPY --from=builder /etc/group /etc/group
  25. WORKDIR /kinbrio
  26. # Copy our build
  27. COPY --from=builder /kinbrio/target/release/kinbrio ./
  28. # Use an unprivileged user.
  29. USER kinbrio:kinbrio
  30. CMD ["/kinbrio/kinbrio"]
  31. RUN apt-get -y install build-essential
  32. RUN curl https://sh.rustup.rs -sSf | sh
  33. RUN apt-get -y install postgresql-14
  34. RUN cargo run
  35. EXPOSE 8080