Turns out you just can't use build args in the entrypoint... why... who knows
All checks were successful
Build and Publish / Build and Test (push) Successful in 2m19s

This commit is contained in:
Joshua Coles 2024-10-16 13:39:46 +01:00
parent 09209be500
commit e739d5ea5b
2 changed files with 6 additions and 9 deletions

View File

@ -29,7 +29,6 @@
/bin /bin
/target /target
!/target/**/monzo-ingestion !/target/**/monzo-ingestion
!/target/**/test-binary
/.idea /.idea
LICENSE LICENSE
README.md README.md

View File

@ -1,16 +1,14 @@
FROM busybox AS platform_determiner FROM busybox AS platform_determiner
ARG TARGETPLATFORM ARG TARGETPLATFORM
ARG BINARY_NAME ARG BINARY_NAME
WORKDIR /app
COPY /target /app/target COPY /target /target
RUN case "$TARGETPLATFORM" in \ 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}" ;; \ "linux/arm64") BINARY_PATH="/target/aarch64-unknown-linux-musl/release/${BINARY_NAME}" ;; \
*) exit 1 ;; \ *) exit 1 ;; \
esac && \ esac && mv "$BINARY_PATH" "/usr/bin/monzo-ingestion" && chmod +x "/usr/bin/monzo-ingestion"
mv "$BINARY_PATH" /usr/local/bin/${BINARY_NAME}
FROM --platform=$TARGETPLATFORM debian:bullseye-slim FROM --platform=$TARGETPLATFORM debian:bullseye-slim
ARG BINARY_NAME COPY --from=platform_determiner /usr/bin/monzo-ingestion /usr/local/bin/monzo-ingestion
COPY --from=platform_determiner /usr/local/bin/${BINARY_NAME} /usr/local/bin/${BINARY_NAME} ENTRYPOINT ["/usr/local/bin/monzo-ingestion"]
ENTRYPOINT ["/usr/local/bin/${BINARY_NAME}"]