From 723a90d3fb0831dd0bf1995a2821574e355ce478 Mon Sep 17 00:00:00 2001 From: Adrian Mouat Date: Mon, 28 Oct 2024 15:50:57 +0000 Subject: [PATCH] Tidy up some of the YAML Signed-off-by: Adrian Mouat --- .github/workflows/build-and-push-cross.yaml | 1 + .github/workflows/build-and-push.yaml | 6 ++---- Dockerfile | 6 ++---- cross-xx.Dockerfile | 2 +- cross.Dockerfile | 2 +- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-and-push-cross.yaml b/.github/workflows/build-and-push-cross.yaml index 7e92611..35ab1ac 100644 --- a/.github/workflows/build-and-push-cross.yaml +++ b/.github/workflows/build-and-push-cross.yaml @@ -30,6 +30,7 @@ jobs: name: Build and push uses: docker/build-push-action@v6 with: + file: cross.Dockerfile platforms: linux/amd64,linux/arm64 push: true tags: amouat/images-bite-back:latest diff --git a/.github/workflows/build-and-push.yaml b/.github/workflows/build-and-push.yaml index cd012ed..cb7def8 100644 --- a/.github/workflows/build-and-push.yaml +++ b/.github/workflows/build-and-push.yaml @@ -14,9 +14,6 @@ jobs: docker: runs-on: ubuntu-latest steps: - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -36,7 +33,8 @@ jobs: name: Build and push uses: docker/build-push-action@v6 with: - platforms: linux/amd64,linux/arm64 + file: Dockerfile + platforms: linux/amd64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 7d5d807..92ed354 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,11 +7,9 @@ COPY go.mod /work/ COPY cmd /work/cmd COPY internal /work/internal -# See https://mt165.co.uk/blog/static-link-go/ for creating static binaries RUN CGO_ENABLED=0 go build -o hello ./cmd/server FROM cgr.dev/chainguard/static -COPY --from=builder /work/hello /hello - -ENTRYPOINT ["/hello"] +COPY --from=builder /work/hello /hello +ENTRYPOINT ["/hello"] \ No newline at end of file diff --git a/cross-xx.Dockerfile b/cross-xx.Dockerfile index a593523..5276e99 100644 --- a/cross-xx.Dockerfile +++ b/cross-xx.Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 # Load cross-platform helper functions FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx @@ -12,7 +13,6 @@ COPY go.mod /work/ COPY cmd /work/cmd COPY internal /work/internal -# See https://mt165.co.uk/blog/static-link-go/ for creating static binaries #RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -o hello ./cmd/server RUN CGO_ENABLED=0 xx-go build -o hello ./cmd/server diff --git a/cross.Dockerfile b/cross.Dockerfile index 45ea1e8..8b77c69 100644 --- a/cross.Dockerfile +++ b/cross.Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 FROM --platform=$BUILDPLATFORM cgr.dev/chainguard/go:latest-dev AS builder ARG TARGETOS ARG TARGETARCH @@ -7,7 +8,6 @@ COPY go.mod /work/ COPY cmd /work/cmd COPY internal /work/internal -# See https://mt165.co.uk/blog/static-link-go/ for creating static binaries RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -o hello ./cmd/server FROM cgr.dev/chainguard/static