-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: refactor GitHub Actions and Docker build-push-action settings
- Add a new docker setup workflow to GitHub actions - Clean up `docker_publish` workflow by reusing the docker setup steps - Update permissions for the `docker_publish` job to write packages - Replace hard-coded parts with variables (such as `DOCKERHUB_USERNAME` and `DOCKERHUB_TOKEN`) - Set `VERSION` to be `latest` by default in `Dockerfile` - Modify the docker build and push step in the GitHub action to include more options such as caching to registry, sbom, and provenance - Change the docker image source to `minio/mc:$VERSION` from `minio/mc` for version control - Add support for multi-arch in the compression stage of Dockerfile. Signed-off-by: 陳鈞 <jim60105@gmail.com>
- Loading branch information
Showing
3 changed files
with
85 additions
and
45 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,58 @@ | ||
name: Setup docker | ||
|
||
description: Configure the docker workflow. | ||
|
||
inputs: | ||
DOCKERHUB_ORGANIZATION_NAME : | ||
required: true | ||
DOCKERHUB_USERNAME: | ||
required: true | ||
DOCKERHUB_TOKEN: | ||
required: true | ||
tag: | ||
required: true | ||
|
||
outputs: | ||
tags: | ||
description: "tags" | ||
value: ${{ steps.meta.outputs.tags }} | ||
labels: | ||
description: "labels" | ||
value: ${{ steps.meta.outputs.labels }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Docker meta:${{ inputs.tag }} | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ inputs.DOCKERHUB_ORGANIZATION_NAME }}/s3-uploader,ghcr.io/${{ github.repository_owner }}/s3-uploader | ||
flavor: | | ||
latest=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | ||
prefix= | ||
suffix= | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# Create a Access Token and save it as as Actions secret | ||
# https://hub.docker.com/settings/security | ||
# DOCKERHUB_USERNAME | ||
# DOCKERHUB_TOKEN | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ inputs.DOCKERHUB_USERNAME }} | ||
password: ${{ inputs.DOCKERHUB_TOKEN }} | ||
|
||
# You may need to manage write and read access of GitHub Actions for repositories in the container settings. | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ github.token }} |
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