From 49f5603bffae9965e41e20d46c271774fcf95733 Mon Sep 17 00:00:00 2001 From: gh0st <1264131+gh0st42@users.noreply.github.com> Date: Mon, 12 Feb 2024 10:37:52 +0100 Subject: [PATCH] fix(build): fixed permission bug for docker start script --- .dockerignore | 1 + core/dtn7/src/core/helpers.rs | 2 +- dockerfiles/Dockerfile.debian-bookwork-slim | 24 +++++++-------------- dockerfiles/start_dtnd | 0 4 files changed, 10 insertions(+), 17 deletions(-) create mode 100644 .dockerignore mode change 100644 => 100755 dockerfiles/start_dtnd diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..ea8c4bf7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +/target diff --git a/core/dtn7/src/core/helpers.rs b/core/dtn7/src/core/helpers.rs index 5c1908b5..7e059455 100644 --- a/core/dtn7/src/core/helpers.rs +++ b/core/dtn7/src/core/helpers.rs @@ -50,7 +50,7 @@ pub fn rnd_peer() -> DtnPeer { } /// Peer Connection URL Parsing Errors -#[derive(Error, Debug, PartialEq)] +#[derive(Error, Debug, PartialEq, Eq)] pub enum ParsePeerUrlError { #[error("invalid URL format error")] InvalidUrl, diff --git a/dockerfiles/Dockerfile.debian-bookwork-slim b/dockerfiles/Dockerfile.debian-bookwork-slim index f9c4d634..b8295333 100644 --- a/dockerfiles/Dockerfile.debian-bookwork-slim +++ b/dockerfiles/Dockerfile.debian-bookwork-slim @@ -1,35 +1,27 @@ -ARG ARCH= +FROM docker.io/rust:1.76 as builder -FROM ${ARCH}rust:1.75 as builder - -WORKDIR /root -#RUN rustup component add rustfmt -#RUN git clone https://github.com/dtn7/dtn7-rs && cd dtn7-rs && \ -# git checkout 43fac1cc2ead3a8fa9e1825f8265a77dd9298daa && \ +WORKDIR /root/ COPY . dtn7 RUN cd dtn7 && \ cargo install --locked --bins --examples --root /usr/local --path examples && \ cargo install --locked --bins --examples --root /usr/local --path core/dtn7 RUN cargo install --locked --bins --examples --root /usr/local dtn7-plus --git https://github.com/dtn7/dtn7-plus-rs --rev 010202e56 dtn7-plus -FROM debian:bookworm-slim +FROM docker.io/debian:bookworm-slim ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt install net-tools iproute2 iputils-ping tcpdump wget curl -y -WORKDIR /opt -# RUN wget https://github.com/dtn7/dtn7-rs/releases/download/v0.19.0/dtn7-0.19.0-x86_64-unknown-linux-musl.tar.gz && \ -# mkdir -p /opt/dtn7 && \ -# tar -xvf dtn7-0.19.0-x86_64-unknown-linux-musl.tar.gz -C /opt/dtn7 --strip-components=1 && \ -# rm dtn7-0.19.0-x86_64-unknown-linux-musl.tar.gz && \ -# cp /opt/dtn7/bin/* /usr/local/bin && \ -# cp /opt/dtn7/examples/* /usr/local/bin - +WORKDIR / COPY --from=builder /usr/local/bin/* /usr/local/bin/ COPY dockerfiles/start_dtnd /usr/local/bin/start_dtnd +ENV PATH="${PATH}:/usr/local/bin:/usr/local/sbin" + HEALTHCHECK --interval=60s --timeout=10s --start-period=15s --retries=3 \ CMD curl --fail http://localhost:3000 || exit 1 + + ENTRYPOINT [ "start_dtnd" ] diff --git a/dockerfiles/start_dtnd b/dockerfiles/start_dtnd old mode 100644 new mode 100755