diff --git a/.github/workflows/build-images.yaml b/.github/workflows/build-images.yaml new file mode 100644 index 0000000000..ae5d059a5d --- /dev/null +++ b/.github/workflows/build-images.yaml @@ -0,0 +1,22 @@ +name: Build Images + +on: [pull_request] + +jobs: + build: + name: Build job + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./.github/composite/go-setup + - name: Install uuid + run: | + sudo apt-get update + sudo apt-get install uuid + - name: Build Util Image + run: | + docker buildx create --name multiarch --driver docker-container --use + docker buildx build . -f Dockerfile.utils \ + --platform=linux/ppc64le,linux/s390x,linux/amd64,linux/arm64 \ + --push \ + -t "ttl.sh/knative/func-util-$(uuid):2h" diff --git a/Dockerfile.utils b/Dockerfile.utils new file mode 100644 index 0000000000..587d350f31 --- /dev/null +++ b/Dockerfile.utils @@ -0,0 +1,21 @@ +FROM --platform=$BUILDPLATFORM index.docker.io/library/golang:1.22.1-alpine3.19 AS builder + +ARG BUILDPLATFORM +ARG TARGETPLATFORM +ARG TARGETARCH + +COPY . . + +RUN GOARCH=$TARGETARCH go build -o deploy -trimpath -ldflags '-w -s' ./cmd/func-deployer + +######################### + +FROM --platform=$TARGETPLATFORM index.docker.io/library/alpine:latest + +RUN apk add --no-cache socat tar \ + && addgroup func -g 1000 \ + && adduser func -u 1001 -D -G func + +COPY --from=builder /go/deploy /usr/local/bin/ + +USER func:func