From d722d819cba8427754e1eec7c7aaed34940c0c1b Mon Sep 17 00:00:00 2001 From: Petko Date: Mon, 13 Mar 2023 14:33:34 +0200 Subject: [PATCH] chore: slim down Dockerfile --- Cargo.toml | 2 +- Dockerfile | 20 +++++++++++++------- docker-compose.yml | 6 ------ 3 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 docker-compose.yml diff --git a/Cargo.toml b/Cargo.toml index 91c92f5..f16250b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "poi-radio" -version = "0.0.8" +version = "0.0.9" edition = "2021" authors = ["GraphOps (axiomatic-aardvark, hopeyen)"] description="POI Radio monitors subgraph data integrity in real time using Graphcast SDK" diff --git a/Dockerfile b/Dockerfile index b71eb11..a65339f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:latest +FROM rust:1-bullseye AS build-image RUN apt-get update \ && apt-get install -y --no-install-recommends \ @@ -14,15 +14,21 @@ RUN apt-get update \ RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup-init.sh \ -&& sh rustup-init.sh -y --default-toolchain stable --no-modify-path -ENV PATH="/root/.cargo/bin:${PATH}" - COPY . /poi-radio WORKDIR /poi-radio RUN sh install-golang.sh ENV PATH=$PATH:/usr/local/go/bin -RUN cargo build -CMD ["cargo", "run"] +RUN cargo build --release + +FROM debian:bullseye-slim AS runtime +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + libpq-dev \ + pkg-config \ + libssl-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* +COPY --from=build-image "/poi-radio/target/release/poi-radio" "/usr/bin/local/poi-radio" +ENTRYPOINT [ "/usr/bin/local/poi-radio" ] diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 2951b3f..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: "3" -services: - poi-radio: - build: . - ports: - - 8030:8030