From 8890c7773912d7b58950964d42967455977f2f96 Mon Sep 17 00:00:00 2001 From: Wayback Archiver <66856220+waybackarchiver@users.noreply.github.com> Date: Wed, 2 Nov 2022 14:20:23 +0000 Subject: [PATCH] Fix ipfs credential (#242) * Fix ipfs credential for docker image * Fix ipfs credential for aur package * Refine docker buildx inherits --- .github/workflows/docker.yml | 4 ++++ Dockerfile | 4 ++++ build/aur | 2 +- docker-bake.hcl | 34 +++++++++++++++++----------------- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f8a51ca8..93747aad 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -100,6 +100,8 @@ jobs: - name: Build and push Docker image uses: docker/bake-action@fb56172975f3a7f62d2defb5d32d735a2eaa41eb # v2.0.0 + env: + WAYBACK_IPFS_APIKEY: ${{ secrets.WAYBACK_IPFS_APIKEY }} with: files: | ./docker-bake.hcl @@ -197,6 +199,8 @@ jobs: - name: Build and push Docker image uses: docker/bake-action@fb56172975f3a7f62d2defb5d32d735a2eaa41eb # v2.0.0 + env: + WAYBACK_IPFS_APIKEY: ${{ secrets.WAYBACK_IPFS_APIKEY }} with: files: | ./docker-bake.hcl diff --git a/Dockerfile b/Dockerfile index cdaadcb0..e6a6e3da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,8 +11,12 @@ COPY --from=tonistiigi/xx:golang / / RUN apk add --no-cache -U build-base ca-certificates linux-headers musl-dev git tar ARG TARGETPLATFORM +ARG WAYBACK_IPFS_APIKEY + WORKDIR /src +ENV WAYBACK_IPFS_APIKEY ${WAYBACK_IPFS_APIKEY} + COPY . . RUN --mount=type=bind,target=/src,rw \ --mount=type=cache,target=/root/.cache/go-build \ diff --git a/build/aur b/build/aur index 07f1bd76..f02a81fb 160000 --- a/build/aur +++ b/build/aur @@ -1 +1 @@ -Subproject commit 07f1bd769bd241e1eb808f2f0c9ca272680b39f0 +Subproject commit f02a81fbc498cd8f5d0d8d8541889e3c4171c6c6 diff --git a/docker-bake.hcl b/docker-bake.hcl index 2bcfa477..9681246f 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -3,10 +3,8 @@ variable "GO_VERSION" { default = "1.19" } -target "go-version" { - args = { - GO_VERSION = GO_VERSION - } +variable "WAYBACK_IPFS_APIKEY" { + default = "" } // GitHub reference as defined in GitHub Actions (eg. refs/head/master)) @@ -14,9 +12,10 @@ variable "GITHUB_REF" { default = "" } -target "git-ref" { +target "_common" { args = { - GIT_REF = GITHUB_REF + GO_VERSION = GO_VERSION + WAYBACK_IPFS_APIKEY = WAYBACK_IPFS_APIKEY } } @@ -29,7 +28,17 @@ target "docker-metadata-action" { tags = ["wabarc/wayback:local"] } +target "image" { + inherits = ["_common", "docker-metadata-action"] +} + +target "image-local" { + inherits = ["image"] + output = ["type=docker"] +} + target "artifact" { + inherits = ["image"] output = ["./dist"] } @@ -46,17 +55,8 @@ target "artifact-all" { ] } -target "image" { - inherits = ["docker-metadata-action"] -} - -target "image-local" { - inherits = ["image"] - output = ["type=docker"] -} - target "release" { - inherits = ["docker-metadata-action"] + inherits = ["image"] context = "./" platforms = [ "linux/386", @@ -70,7 +70,7 @@ target "release" { } target "bundle" { - inherits = ["docker-metadata-action"] + inherits = ["image"] context = "./" dockerfile = "./build/docker/Dockerfile.all" platforms = [