Mohammed Naser | c639230 | 2024-01-04 00:43:02 -0500 | [diff] [blame] | 1 | VERSION 0.7 |
| 2 | ARG --global COMMIT=e8c2b17e1261c6a1b0fed1fcd5e1c337fc014219 |
| 3 | |
| 4 | build: |
| 5 | FROM golang:1.21.5-bookworm |
| 6 | DO ../+APT_INSTALL --PACKAGES "patch" |
| 7 | GIT CLONE --branch ${COMMIT} https://opendev.org/airship/kubernetes-entrypoint /src |
| 8 | WORKDIR /src |
| 9 | RUN \ |
| 10 | curl https://review.opendev.org/changes/airship%2Fkubernetes-entrypoint~904537/revisions/1/patch?download | \ |
| 11 | base64 --decode | \ |
| 12 | patch -p1 |
| 13 | ARG GOARCH |
| 14 | RUN \ |
| 15 | --mount=type=cache,mode=0755,target=/go/pkg/mod \ |
| 16 | CGO_ENABLED=0 GOOS=linux go build -o /main |
| 17 | SAVE ARTIFACT /main |
| 18 | |
| 19 | platform-image: |
| 20 | FROM scratch |
| 21 | ARG TARGETARCH |
| 22 | COPY \ |
| 23 | --platform=linux/amd64 \ |
| 24 | (+build/main --GOARCH=$TARGETARCH) /kubernetes-entrypoint |
| 25 | USER 65534 |
| 26 | ENTRYPOINT ["/kubernetes-entrypoint"] |
| 27 | SAVE IMAGE --push \ |
| 28 | ghcr.io/vexxhost/atmosphere/kubernetes-entrypoint:${COMMIT} \ |
| 29 | ghcr.io/vexxhost/atmosphere/kubernetes-entrypoint:latest |
| 30 | |
| 31 | image: |
| 32 | BUILD --platform linux/amd64 --platform linux/arm64 +platform-image |