From 506a55837927243f9adbe937aaac18e6e3244b4e Mon Sep 17 00:00:00 2001 From: Anuraag Agrawal Date: Tue, 4 Oct 2022 10:47:40 +0900 Subject: [PATCH 1/5] Publish docker images to ghcr with release --- .github/workflows/release.yml | 7 +++++++ .gitignore | 1 + .goreleaser.yml | 24 +++++++++++++++++++++++- Dockerfile | 3 +++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 92af559..0961764 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,6 +19,13 @@ jobs: uses: actions/setup-go@v2 with: go-version: 1.16 + - + name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 diff --git a/.gitignore b/.gitignore index 4284f60..1c3d73f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,5 +14,6 @@ # Dependency directories (remove the comment below to include it) # vendor/ .vscode +.idea build/ \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index 124c1dc..83909d7 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -16,6 +16,7 @@ builds: - darwin goarch: - amd64 + - arm64 archives: - name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}" replacements: @@ -46,7 +47,28 @@ changelog: - '^test' release: prerelease: auto - +dockers: + - image_templates: + - "ghcr.io/coreruleset/go-ftw:{{ .Version }}-amd64" + use: buildx + goarch: amd64 + build_flag_templates: + - "--platform=linux/amd64" + - image_templates: + - "ghcr.io/coreruleset/go-ftw:{{ .Version }}-arm64" + use: buildx + goarch: arm64 + build_flag_templates: + - "--platform=linux/arm64" +docker_manifests: + - name_template: "ghcr.io/coreruleset/go-ftw:latest" + image_templates: + - "ghcr.io/coreruleset/go-ftw:{{ .Version }}-amd64" + - "ghcr.io/coreruleset/go-ftw:{{ .Version }}-arm64" + - name_template: "ghcr.io/coreruleset/go-ftw:{{ .Version }}" + image_templates: + - "ghcr.io/coreruleset/go-ftw:{{ .Version }}-amd64" + - "ghcr.io/coreruleset/go-ftw:{{ .Version }}-arm64" nfpms: - id: "ftw" builds: ["ftw"] diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4cd5627 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM gcr.io/distroless/static-debian11:debug +ENTRYPOINT ["/ftw"] +COPY ftw / \ No newline at end of file From 31dbf77a30fb99bb7373ef474afc68bd6f862164 Mon Sep 17 00:00:00 2001 From: Anuraag Agrawal Date: Tue, 4 Oct 2022 10:57:56 +0900 Subject: [PATCH 2/5] newline --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4cd5627..70e061d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,3 @@ FROM gcr.io/distroless/static-debian11:debug ENTRYPOINT ["/ftw"] -COPY ftw / \ No newline at end of file +COPY ftw / From 7e86cd48efcc39dbd0ab0b5affe3c72d3d7a3da8 Mon Sep 17 00:00:00 2001 From: Anuraag Agrawal Date: Wed, 5 Oct 2022 10:18:36 +0900 Subject: [PATCH 3/5] Non-debug image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 70e061d..1a9706b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,3 @@ -FROM gcr.io/distroless/static-debian11:debug +FROM gcr.io/distroless/static-debian11 ENTRYPOINT ["/ftw"] COPY ftw / From b45c7b20a1e7fab03bf40d2f6e9c616690c14094 Mon Sep 17 00:00:00 2001 From: Anuraag Agrawal Date: Wed, 5 Oct 2022 10:20:13 +0900 Subject: [PATCH 4/5] Revert "Non-debug image" This reverts commit 7e86cd48efcc39dbd0ab0b5affe3c72d3d7a3da8. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1a9706b..70e061d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,3 @@ -FROM gcr.io/distroless/static-debian11 +FROM gcr.io/distroless/static-debian11:debug ENTRYPOINT ["/ftw"] COPY ftw / From 60bfdf95dd9ad3cdab1f4d28860097cf0e0ea0ac Mon Sep 17 00:00:00 2001 From: Anuraag Agrawal Date: Wed, 5 Oct 2022 12:23:07 +0900 Subject: [PATCH 5/5] alpine base image --- .gitignore | 3 ++- Dockerfile | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 1c3d73f..552b813 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,5 @@ .vscode .idea -build/ \ No newline at end of file +build/ +dist/ diff --git a/Dockerfile b/Dockerfile index 70e061d..270236d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,6 @@ -FROM gcr.io/distroless/static-debian11:debug +FROM alpine:3 + +RUN apk add --no-cache ca-certificates + ENTRYPOINT ["/ftw"] COPY ftw /