Skip to content

Commit

Permalink
Add labels org.opencontainers.image.source and org.opencontainers.ima…
Browse files Browse the repository at this point in the history
…ge.revision
  • Loading branch information
robinschneider committed Apr 16, 2024
1 parent 8ec7594 commit c7c514c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -207,23 +207,34 @@ 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
BUILD +set-revision
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

0 comments on commit c7c514c

Please sign in to comment.