-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix execuable versioning inside docker container (#96)
* bug: fix docker git versioning * feat: include docker cache mount * ci: Split docker to seperate workflow
- Loading branch information
1 parent
f11e795
commit 30763a0
Showing
3 changed files
with
107 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: Docker | ||
on: | ||
push: | ||
branches: | ||
- '**' | ||
tags: | ||
- 'v*' | ||
paths: | ||
- 'go.sum' | ||
- 'go.mod' | ||
- '**.go' | ||
- .github/workflows/docker.yml | ||
- dist.Dockerfile | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- '**.go' | ||
- 'go.sum' | ||
- 'go.mod' | ||
- dist.Dockerfile | ||
- .github/workflows/docker.yml | ||
|
||
permissions: | ||
actions: write | ||
packages: write | ||
id-token: write | ||
attestations: write | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
Docker: | ||
runs-on: ubuntu-latest | ||
env: | ||
GO111MODULE: on | ||
steps: | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} | ||
with: | ||
username: cyb3rjak3 | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Login to GitHub Container Registry | ||
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Docker Meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: cyb3rjak3/cloudflare-utils,ghcr.io/cyb3r-jak3/cloudflare-utils | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
path: cloudflare-utils | ||
|
||
- name: Build | ||
uses: docker/build-push-action@v6 | ||
id: build | ||
with: | ||
context: cloudflare-utils | ||
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} | ||
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/arm/v6, linux/386 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
file: cloudflare-utils/dist.Dockerfile | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
sbom: true | ||
provenance: mode=max | ||
|
||
- name: Docker Hub Description | ||
uses: peter-evans/dockerhub-description@v4 | ||
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} | ||
with: | ||
username: cyb3rjak3 | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
repository: cyb3rjak3/cloudflare-utils | ||
readme-filepath: cloudflare-utils/README.md | ||
|
||
- name: GitHub Container Attestation | ||
uses: actions/attest-build-provenance@v1 | ||
id: attest | ||
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} | ||
with: | ||
subject-name: ghcr.io/cyb3r-jak3/cloudflare-utils | ||
subject-digest: ${{ steps.build.outputs.digest }} | ||
push-to-registry: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters