diff --git a/.github/goreleaser.yaml b/.github/goreleaser.yaml index 5695a29..9c623be 100644 --- a/.github/goreleaser.yaml +++ b/.github/goreleaser.yaml @@ -7,18 +7,28 @@ before: builds: - main: ./cmd binary: faucet + env: + - CGO_ENABLED=0 goos: - linux - darwin goarch: - amd64 - arm64 + - arm + goarm: + - 6 + - 7 gomod: proxy: true archives: - - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + # https://goreleaser.com/customization/archive/ + - files: + # Standard Release Files + - LICENSE.md + - README.md signs: - cmd: cosign @@ -35,18 +45,76 @@ signs: output: true dockers: - - image_templates: - - "ghcr.io/gnolang/faucet:latest" - - "ghcr.io/gnolang/faucet:{{ .Tag }}" + # https://goreleaser.com/customization/docker/ + - use: buildx dockerfile: Dockerfile.release + goos: linux + goarch: amd64 + image_templates: + - "ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }}-amd64" + - "ghcr.io/gnolang/{{ .ProjectName }}:latest-amd64" build_flag_templates: - - "--pull" + - "--platform=linux/amd64" - "--label=org.opencontainers.image.created={{.Date}}" - - "--label=org.opencontainers.image.name={{.ProjectName}}" + - "--label=org.opencontainers.image.title={{.ProjectName}}" - "--label=org.opencontainers.image.revision={{.FullCommit}}" - "--label=org.opencontainers.image.version={{.Version}}" - - "--label=org.opencontainers.image.source={{.GitURL}}" - + - use: buildx + dockerfile: Dockerfile.release + goos: linux + goarch: arm64 + image_templates: + - "ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }}-arm64v8" + - "ghcr.io/gnolang/{{ .ProjectName }}:latest-arm64v8" + build_flag_templates: + - "--platform=linux/arm64/v8" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.title={{.ProjectName}}" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" + - use: buildx + dockerfile: Dockerfile.release + goos: linux + goarch: arm + goarm: 6 + image_templates: + - "ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }}-armv6" + - "ghcr.io/gnolang/{{ .ProjectName }}:latest-armv6" + build_flag_templates: + - "--platform=linux/arm/v6" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.title={{.ProjectName}}" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" + - use: buildx + dockerfile: Dockerfile.release + goos: linux + goarch: arm + goarm: 7 + image_templates: + - "ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }}-armv7" + - "ghcr.io/gnolang/{{ .ProjectName }}:latest-armv7" + build_flag_templates: + - "--platform=linux/arm/v7" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.title={{.ProjectName}}" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" +docker_manifests: + # https://goreleaser.com/customization/docker_manifest/ + - name_template: ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }} + image_templates: + - ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }}-amd64 + - ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }}-arm64v8 + - ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }}-armv6 + - ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }}-armv7 + - name_template: ghcr.io/gnolang/{{ .ProjectName }}:latest + image_templates: + - ghcr.io/gnolang/{{ .ProjectName }}:latest-amd64 + - ghcr.io/gnolang/{{ .ProjectName }}:latest-arm64v8 + - ghcr.io/gnolang/{{ .ProjectName }}:latest-armv6 + - ghcr.io/gnolang/{{ .ProjectName }}:latest-armv7 + docker_signs: - cmd: cosign env: @@ -79,10 +147,9 @@ release: footer: | ### Container Images - https://ghcr.io/gnolang/faucet:{{ .Tag }} + https://ghcr.io/gnolang/{{ .ProjectName }}:{{ .Tag }} For example: ``` - docker pull ghcr.io/gnolang/faucet:{{ .Tag }} + docker pull ghcr.io/gnolang/{{ .ProjectName }}:{{ .Tag }} ``` - diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 100fd51..83490e3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -32,9 +32,12 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - uses: goreleaser/goreleaser-action@v5 with: version: latest args: release --clean --config ./.github/goreleaser.yaml env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile.release b/Dockerfile.release index ab2cdc7..9d1d991 100644 --- a/Dockerfile.release +++ b/Dockerfile.release @@ -1,5 +1,4 @@ -FROM alpine - -COPY faucet /usr/local/bin/gnofaucet - -ENTRYPOINT [ "/usr/local/bin/faucet" ] +FROM scratch +COPY faucet / +ENTRYPOINT [ "/faucet" ] +CMD [ "serve" ] \ No newline at end of file