Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Update dockerfile and workflow #644

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions .github/files/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
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"]
ARG BINARY_NAME
ENV BINARY_NAME=${BINARY_NAME}
COPY --from=env --chmod=755 binary "${BINARY_NAME}"
ENTRYPOINT ["./${BINARY_NAME}"]
3 changes: 2 additions & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
needs: build
permissions:
packages: write
runs-on: 'ubuntu-latest'
runs-on: "ubuntu-latest"
outputs:
image_tags: ${{ steps.meta.outputs.tags }}
env:
Expand Down Expand Up @@ -138,6 +138,7 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
with:
build-args: BINARY_NAME=${{ env.BINARY_NAME }}
context: .
file: .github/files/build/Dockerfile
platforms: darwin/amd64,darwin/arm64,linux/amd64,linux/arm64
Expand Down
Loading