mirror of
https://github.com/MuXiu1997/traefik-github-oauth-plugin
synced 2025-12-17 18:31:27 +00:00
ci: build multi-platform Docker images using goreleaser
release-as: 0.3.1 closed #22
This commit is contained in:
30
.github/workflows/release.yml
vendored
30
.github/workflows/release.yml
vendored
@@ -32,21 +32,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
ref: ${{ steps.release.outputs.tag_name }}
|
ref: ${{ steps.release.outputs.tag_name }}
|
||||||
|
|
||||||
- name: Build
|
|
||||||
if: ${{ steps.release.outputs.release_created }}
|
|
||||||
run: make
|
|
||||||
|
|
||||||
- name: Upload Release Assets
|
|
||||||
if: ${{ steps.release.outputs.release_created }}
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
run: gh release upload ${{ steps.release.outputs.tag_name }} dist/*
|
|
||||||
|
|
||||||
# region Docker
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
if: ${{ steps.release.outputs.release_created }}
|
if: ${{ steps.release.outputs.release_created }}
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
if: ${{ steps.release.outputs.release_created }}
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
if: ${{ steps.release.outputs.release_created }}
|
if: ${{ steps.release.outputs.release_created }}
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
@@ -54,16 +47,15 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build And Push Docker Images
|
- name: Go Release
|
||||||
if: ${{ steps.release.outputs.release_created }}
|
if: ${{ steps.release.outputs.release_created }}
|
||||||
uses: docker/build-push-action@v3
|
uses: goreleaser/goreleaser-action@v4
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
with:
|
with:
|
||||||
context: .
|
distribution: goreleaser
|
||||||
file: ./Dockerfile
|
version: latest
|
||||||
push: true
|
args: release
|
||||||
tags: |
|
|
||||||
muxiu1997/traefik-github-oauth-server:${{ steps.release.outputs.tag_name }}
|
|
||||||
muxiu1997/traefik-github-oauth-server:latest
|
|
||||||
|
|
||||||
- name: Replace The Relative Path In The README.md
|
- name: Replace The Relative Path In The README.md
|
||||||
if: ${{ steps.release.outputs.release_created }}
|
if: ${{ steps.release.outputs.release_created }}
|
||||||
|
|||||||
114
.goreleaser.yaml
Normal file
114
.goreleaser.yaml
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
# doc: https://goreleaser.com
|
||||||
|
project_name: traefik-github-oauth-server
|
||||||
|
|
||||||
|
before:
|
||||||
|
hooks:
|
||||||
|
- go mod tidy
|
||||||
|
|
||||||
|
builds:
|
||||||
|
- id: traefik-github-oauth-server
|
||||||
|
main: ./cmd/traefik-github-oauth-server
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
goos:
|
||||||
|
- linux
|
||||||
|
- windows
|
||||||
|
- darwin
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- "386"
|
||||||
|
- arm64
|
||||||
|
- arm
|
||||||
|
ldflags:
|
||||||
|
- -s
|
||||||
|
- -w
|
||||||
|
- -X main.version={{ .Version }}
|
||||||
|
- -X main.commit={{ .Commit }}
|
||||||
|
- -X main.date={{ .Date }}
|
||||||
|
- -X main.builtBy=goreleaser
|
||||||
|
mod_timestamp: "{{ .CommitTimestamp }}"
|
||||||
|
|
||||||
|
dockers:
|
||||||
|
- use: buildx
|
||||||
|
goos: linux
|
||||||
|
goarch: amd64
|
||||||
|
image_templates:
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:{{ .Version }}-amd64"
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:latest-amd64"
|
||||||
|
build_flag_templates:
|
||||||
|
- "--platform=linux/amd64"
|
||||||
|
- "--pull"
|
||||||
|
- "--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
|
||||||
|
goos: linux
|
||||||
|
goarch: "386"
|
||||||
|
image_templates:
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:{{ .Version }}-i386"
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:latest-i386"
|
||||||
|
build_flag_templates:
|
||||||
|
- "--platform=linux/386"
|
||||||
|
- "--pull"
|
||||||
|
- "--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
|
||||||
|
goos: linux
|
||||||
|
goarch: arm64
|
||||||
|
image_templates:
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:{{ .Version }}-arm64"
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:latest-arm64"
|
||||||
|
build_flag_templates:
|
||||||
|
- "--platform=linux/arm64"
|
||||||
|
- "--pull"
|
||||||
|
- "--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
|
||||||
|
goos: linux
|
||||||
|
goarch: arm
|
||||||
|
image_templates:
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:{{ .Version }}-arm"
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:latest-arm"
|
||||||
|
build_flag_templates:
|
||||||
|
- "--platform=linux/arm/v6"
|
||||||
|
- "--pull"
|
||||||
|
- "--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:
|
||||||
|
- name_template: "muxiu1997/{{ .ProjectName }}:{{ .Version }}"
|
||||||
|
image_templates:
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:{{ .Version }}-amd64"
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:{{ .Version }}-i386"
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:{{ .Version }}-arm64"
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:{{ .Version }}-arm"
|
||||||
|
- name_template: "muxiu1997/{{ .ProjectName }}:latest"
|
||||||
|
image_templates:
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:latest-amd64"
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:latest-i386"
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:latest-arm64"
|
||||||
|
- "muxiu1997/{{ .ProjectName }}:latest-arm"
|
||||||
|
|
||||||
|
archives:
|
||||||
|
- id: tar.gz
|
||||||
|
format: tar.gz
|
||||||
|
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ if eq .Arch "386" }}i386{{ else }}{{ .Arch }}{{ end }}'
|
||||||
|
# use zip for windows archives
|
||||||
|
format_overrides:
|
||||||
|
- goos: windows
|
||||||
|
format: zip
|
||||||
|
- id: binary
|
||||||
|
format: binary
|
||||||
|
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ if eq .Arch "386" }}i386{{ else }}{{ .Arch }}{{ end }}'
|
||||||
|
|
||||||
|
checksum:
|
||||||
|
name_template: 'checksums.txt'
|
||||||
|
snapshot:
|
||||||
|
name_template: "{{ .Version }}-next"
|
||||||
@@ -2,10 +2,10 @@ FROM alpine:latest
|
|||||||
|
|
||||||
RUN apk add --no-cache ca-certificates && update-ca-certificates
|
RUN apk add --no-cache ca-certificates && update-ca-certificates
|
||||||
|
|
||||||
COPY /dist/traefik-github-oauth-server /app/traefik-github-oauth-server
|
COPY traefik-github-oauth-server /app/traefik-github-oauth-server
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
CMD ["/app/traefik-github-oauth-server"]
|
ENTRYPOINT ["/app/traefik-github-oauth-server"]
|
||||||
|
|||||||
Reference in New Issue
Block a user