From 2ba350051e30ad9386f699c0a15b36b27f0fe1e5 Mon Sep 17 00:00:00 2001 From: Bufo Date: Thu, 4 Jul 2024 20:12:49 +0200 Subject: [PATCH 1/4] feat: add Dockerfile --- Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b89d930 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM rust:1.78 + +WORKDIR /app + +COPY ./ ./ + +RUN cargo build --release + +CMD ["./target/release/covclaim"] \ No newline at end of file From 0ea64130ab830554e7120ee27d34b779e89cd47b Mon Sep 17 00:00:00 2001 From: Bufo Date: Thu, 4 Jul 2024 22:32:36 +0200 Subject: [PATCH 2/4] chore: expose port in Dockerfile --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index b89d930..ac589fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,4 +6,6 @@ COPY ./ ./ RUN cargo build --release +EXPOSE 1234 + CMD ["./target/release/covclaim"] \ No newline at end of file From 8561948bd22aed1b9e6e63eb5ac27518445f48c8 Mon Sep 17 00:00:00 2001 From: Bufo Date: Mon, 8 Jul 2024 11:42:25 +0200 Subject: [PATCH 3/4] chore: divide build and run stage --- Dockerfile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ac589fc..3659500 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.78 +FROM rust:1.79 as builder WORKDIR /app @@ -6,6 +6,17 @@ COPY ./ ./ RUN cargo build --release +FROM debian:bookworm-slim + +RUN apt-get update && \ + apt-get upgrade && \ + apt-get install -y libsqlite3-0 libpq5 && \ + apt-get clean all && \ + rm -rf /var/lib/apt/lists/* + +COPY --from=builder /app/target/release/covclaim /usr/local/bin/covclaim +COPY --from=builder /app/.env /.env + EXPOSE 1234 -CMD ["./target/release/covclaim"] \ No newline at end of file +CMD ["/usr/local/bin/covclaim"] \ No newline at end of file From eeb91fce294a32c635163a06946dee59456ec8c5 Mon Sep 17 00:00:00 2001 From: Bufo Date: Mon, 8 Jul 2024 15:12:46 +0200 Subject: [PATCH 4/4] chore: Dockerfile nits --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3659500..b4bb7c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.79 as builder +FROM rust:1.79 AS builder WORKDIR /app @@ -10,7 +10,7 @@ FROM debian:bookworm-slim RUN apt-get update && \ apt-get upgrade && \ - apt-get install -y libsqlite3-0 libpq5 && \ + apt-get install -y libsqlite3-0 libpq5 ca-certificates && \ apt-get clean all && \ rm -rf /var/lib/apt/lists/* @@ -19,4 +19,4 @@ COPY --from=builder /app/.env /.env EXPOSE 1234 -CMD ["/usr/local/bin/covclaim"] \ No newline at end of file +CMD ["/usr/local/bin/covclaim"]