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

🏷️ Add labels to Earthfile #321

Merged
merged 3 commits into from
Apr 16, 2024
Merged
Changes from 2 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
15 changes: 12 additions & 3 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -207,23 +207,32 @@ set-version:
RUN git describe --tags --always > VERSION
SAVE ARTIFACT VERSION

set-revision:
FROM alpine/git
COPY .git .git
RUN git rev-parse HEAD > REVISION
SAVE ARTIFACT REVISION

ci:
FROM busybox
COPY +set-version/VERSION .
BUILD +docker --CONTROLLER=yawol-controller --DOCKER_TAG=$(cat VERSION)
BUILD +docker --CONTROLLER=yawol-cloud-controller --DOCKER_TAG=$(cat VERSION)
COPY +set-revision/REVISION .
BUILD +docker --CONTROLLER=yawol-controller --DOCKER_TAG=$(cat VERSION) --REVISION=$(cat REVISION)
BUILD +docker --CONTROLLER=yawol-cloud-controller --DOCKER_TAG=$(cat VERSION) --REVISION=$(cat REVISION)

docker:
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG DOCKER_TAG
ARG REVISION
ARG CONTROLLER
FROM --platform=$TARGETPLATFORM \
gcr.io/distroless/static:nonroot
COPY --platform=$USERPLATFORM \
(+build/controller --CONTROLLER=$CONTROLLER --GOOS=$TARGETOS --GOARCH=$TARGETARCH) /controller
BUILD +set-version
LABEL org.opencontainers.image.source="https://github.com/stackitcloud/yawol"
LABEL org.opencontainers.image.revision=$REVISION
USER 65532:65532
ENTRYPOINT ["/controller"]
SAVE IMAGE --push $DOCKER_REPO$CONTROLLER:$DOCKER_TAG
Expand Down