From d7b7c43b8a79d0a799fe091d33d72b24ba509eeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tuomas=20M=C3=A4kinen?= Date: Fri, 19 Jan 2024 17:48:56 +0200 Subject: [PATCH 1/2] Add `Containerfile` to build node container The first version is based on Fedora 39, but that choice shall be revisited later to optimize the container size. --- Containerfile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Containerfile diff --git a/Containerfile b/Containerfile new file mode 100644 index 00000000..ccd0d9f5 --- /dev/null +++ b/Containerfile @@ -0,0 +1,18 @@ +FROM fedora:39 + +# Install QEMU +RUN dnf install -y qemu-kvm qemu-img + +# Install Ops. +RUN /bin/curl -Lo /bin/ops https://storage.googleapis.com/cli/linux/ops && chmod 755 /bin/ops && /bin/ops update + +# Add Gevulot node bin. +ADD target/release/gevulot /gevulot + +ADD crates/node/migrations /migrations + +RUN mkdir -p /var/lib/gevulot +RUN /gevulot generate node-key + +CMD ["run"] +ENTRYPOINT ["/gevulot"] From a33d65440c26be2f65275cfce7daff721b598ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tuomas=20M=C3=A4kinen?= Date: Sun, 21 Jan 2024 11:11:57 +0200 Subject: [PATCH 2/2] Rewrite Containerfile --- Containerfile | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Containerfile b/Containerfile index ccd0d9f5..ba87f2af 100644 --- a/Containerfile +++ b/Containerfile @@ -1,15 +1,29 @@ -FROM fedora:39 +FROM rust:1-bookworm -# Install QEMU -RUN dnf install -y qemu-kvm qemu-img +COPY ./Cargo.* ./ +COPY ./crates ./crates + +RUN apt-get update && apt-get install -y \ + libssl-dev \ + protobuf-compiler + +RUN cargo build --release + +FROM debian:bookworm + +# Copy Gevulot node bin from earlier build step. +COPY --from=0 target/release/gevulot /gevulot + +# Install QEMU. +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + qemu-system # Install Ops. RUN /bin/curl -Lo /bin/ops https://storage.googleapis.com/cli/linux/ops && chmod 755 /bin/ops && /bin/ops update -# Add Gevulot node bin. -ADD target/release/gevulot /gevulot - -ADD crates/node/migrations /migrations +COPY ./crates/node/migrations /migrations RUN mkdir -p /var/lib/gevulot RUN /gevulot generate node-key