From e739d5ea5bb7aa56450478cb67de64ad602b8e8a Mon Sep 17 00:00:00 2001 From: Joshua Coles Date: Wed, 16 Oct 2024 13:39:46 +0100 Subject: [PATCH] Turns out you just can't use build args in the entrypoint... why... who knows --- .dockerignore | 1 - Dockerfile | 14 ++++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.dockerignore b/.dockerignore index d426974..84b16af 100644 --- a/.dockerignore +++ b/.dockerignore @@ -29,7 +29,6 @@ /bin /target !/target/**/monzo-ingestion -!/target/**/test-binary /.idea LICENSE README.md diff --git a/Dockerfile b/Dockerfile index 1a5d13f..7e736be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,14 @@ FROM busybox AS platform_determiner ARG TARGETPLATFORM ARG BINARY_NAME -WORKDIR /app -COPY /target /app/target + +COPY /target /target RUN case "$TARGETPLATFORM" in \ - "linux/amd64") BINARY_PATH="/app/target/release/${BINARY_NAME}" ;; \ + "linux/amd64") BINARY_PATH="/target/release/${BINARY_NAME}" ;; \ "linux/arm64") BINARY_PATH="/target/aarch64-unknown-linux-musl/release/${BINARY_NAME}" ;; \ *) exit 1 ;; \ - esac && \ - mv "$BINARY_PATH" /usr/local/bin/${BINARY_NAME} + esac && mv "$BINARY_PATH" "/usr/bin/monzo-ingestion" && chmod +x "/usr/bin/monzo-ingestion" FROM --platform=$TARGETPLATFORM debian:bullseye-slim -ARG BINARY_NAME -COPY --from=platform_determiner /usr/local/bin/${BINARY_NAME} /usr/local/bin/${BINARY_NAME} -ENTRYPOINT ["/usr/local/bin/${BINARY_NAME}"] +COPY --from=platform_determiner /usr/bin/monzo-ingestion /usr/local/bin/monzo-ingestion +ENTRYPOINT ["/usr/local/bin/monzo-ingestion"]