From 2b2f4096ed5250106818618ebf1146b99aed496a Mon Sep 17 00:00:00 2001 From: BenSchZA Date: Tue, 11 Jun 2024 08:20:26 +0100 Subject: [PATCH 1/2] - Fix Rust version to v1.78 - Use Docker build stage to reduce image size --- Dockerfile.availability-oracle | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/Dockerfile.availability-oracle b/Dockerfile.availability-oracle index ba619c9..6e828c3 100644 --- a/Dockerfile.availability-oracle +++ b/Dockerfile.availability-oracle @@ -1,13 +1,30 @@ -FROM rust:latest as build +# Use an official Rust image to build the project +FROM --platform=linux/amd64 rust:1.78 as build -# Copy and build the project +# Set the working directory WORKDIR /availability-oracle/src -COPY . ./ + +# Copy the source code into the container +COPY . . + +# Build the project RUN cargo install --locked --path availability-oracle -## Clean up the source directory -RUN rm -rf /src +# Use a minimal image for the final stage with a fixed version +FROM --platform=linux/amd64 debian:12-slim + +# Install the necessary dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + libssl3 \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* +# Copy the built binary from the build stage +COPY --from=build /usr/local/cargo/bin/availability-oracle /usr/local/bin/availability-oracle + +# Set the user USER 1000 -ENTRYPOINT ["/usr/local/cargo/bin/availability-oracle"] + +# Set the entrypoint and command +ENTRYPOINT ["/usr/local/bin/availability-oracle"] CMD ["--ipfs", "https://ipfs.network.thegraph.com", "--subgraph", "https://gateway.network.thegraph.com/network", "--period", "300"] From bbd952d2147171d9c313ee8939cd23114fc3b95c Mon Sep 17 00:00:00 2001 From: Benjamin Scholtz Date: Wed, 4 Sep 2024 09:57:32 +0100 Subject: [PATCH 2/2] Remove default CMD --- Dockerfile.availability-oracle | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile.availability-oracle b/Dockerfile.availability-oracle index 6e828c3..eb5aeae 100644 --- a/Dockerfile.availability-oracle +++ b/Dockerfile.availability-oracle @@ -27,4 +27,3 @@ USER 1000 # Set the entrypoint and command ENTRYPOINT ["/usr/local/bin/availability-oracle"] -CMD ["--ipfs", "https://ipfs.network.thegraph.com", "--subgraph", "https://gateway.network.thegraph.com/network", "--period", "300"]