-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update Dockerfile to support configurable binary name during build
The Dockerfile has been updated to include an argument `BINARY_NAME` that allows for the specification of the binary name during the build process. This allows for more flexibility in naming the binary based on different platforms or requirements. The entrypoint has also been updated to use the specified binary name.
- Loading branch information
1 parent
6fb6a8d
commit 383b3c2
Showing
2 changed files
with
14 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
# syntax=docker/dockerfile:1.6.0@sha256:ac85f380a63b13dfcefa89046420e1781752bab202122f8f50032edf31be0021 | ||
ARG BINARY_NAME | ||
FROM --platform=$BUILDPLATFORM busybox:1.36.1-uclibc@sha256:cc71f45a5a48738c4c295314b2bc9bcc18eb0c33e7bb127c3735b751b724141b AS env | ||
ARG TARGETPLATFORM | ||
RUN --mount=type=bind,source=artifact,target=artifact \ | ||
if [ "$TARGETPLATFORM" = 'darwin/amd64' ]; then\ | ||
cp artifact/x86_64-apple-darwin/binary .\ | ||
;elif [ "$TARGETPLATFORM" = 'darwin/arm64' ]; then\ | ||
cp artifact/aarch64-apple-darwin/binary .\ | ||
;elif [ "$TARGETPLATFORM" = 'linux/amd64' ]; then\ | ||
cp artifact/x86_64-unknown-linux-musl/binary .\ | ||
;elif [ "$TARGETPLATFORM" = 'linux/arm64' ]; then\ | ||
cp artifact/aarch64-unknown-linux-musl/binary .\ | ||
;fi | ||
if [ "$TARGETPLATFORM" = 'darwin/amd64' ]; then\ | ||
cp artifact/x86_64-apple-darwin/binary .\ | ||
;elif [ "$TARGETPLATFORM" = 'darwin/arm64' ]; then\ | ||
cp artifact/aarch64-apple-darwin/binary .\ | ||
;elif [ "$TARGETPLATFORM" = 'linux/amd64' ]; then\ | ||
cp artifact/x86_64-unknown-linux-musl/binary .\ | ||
;elif [ "$TARGETPLATFORM" = 'linux/arm64' ]; then\ | ||
cp artifact/aarch64-unknown-linux-musl/binary .\ | ||
;fi | ||
|
||
FROM --platform=$BUILDPLATFORM scratch as runner | ||
COPY --from=env --chmod=755 binary . | ||
ENTRYPOINT ["./binary"] | ||
COPY --from=env --chmod=755 binary "$BINARY_NAME" | ||
ENTRYPOINT ["$BINARY_NAME"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters