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

Use TARGETARCH to get supercronic binary per target platform #1092

Merged
merged 1 commit into from
Aug 26, 2023

Conversation

guidopetri
Copy link
Collaborator

I was looking into how to pass the target arch into a build arg in the Dockerfile, when I found out that it's already available in TARGETARCH. So instead of using ARCH I renamed everything to TARGETARCH and got a successful amd64 build and arm64 build, with the correct versions of the supercronic binary attached. Here's the GH Actions logs; if you search for supercronic you can see L738/739 shows the amd64 build + output, and L1197/1198 shows the arm64 build + output.

ARG ARCH=amd64
ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.3/supercronic-linux-$ARCH \
SUPERCRONIC=supercronic-linux-$ARCH \
ARG TARGETARCH
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does TARGETARCH get populated? Is id thanks to the platform line in our Github action?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort of - TARGETARCH is one of several pre-defined build arguments (full list here). The platform line is telling Docker which architecture to build for, so in a sense it informs what the value of TARGETARCH is but not its existence.

@guidopetri guidopetri merged commit 21206e7 into stringer-rss:main Aug 26, 2023
1 check passed
@guidopetri guidopetri deleted the add-build-args branch August 26, 2023 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants