-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
105 additions
and
99 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
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,72 @@ | ||
name: AutoFilm Docker Builder | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
APP_VERSION: | ||
description: "用于Docker镜像版本的标签号" | ||
required: true | ||
type: string | ||
IS_LATEST: | ||
description: "是否发布为Docker镜像最新版本" | ||
required: true | ||
type: boolean | ||
secrets: | ||
DOCKERHUB_USERNAME: | ||
required: true | ||
DOCKERHUB_TOKEN: | ||
required: true | ||
|
||
env: | ||
APP_VERSION: ${{ inputs.APP_VERSION }} | ||
IS_LATEST: ${{ inputs.IS_LATEST }} | ||
|
||
jobs: | ||
Docker-build: | ||
runs-on: ubuntu-latest | ||
name: Build Docker Image | ||
steps: | ||
- name: Show Information | ||
run: | | ||
echo "Docker镜像版本的标签号:${{ env.APP_VERSION }}" | ||
echo "是否发布为Docker镜像最新版本:${{ env.IS_LATEST }}" | ||
- name: Clone Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Docker Meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ secrets.DOCKERHUB_USERNAME }}/autofilm | ||
tags: | | ||
type=raw,value=latest,enable=true | ||
type=raw,value=${{ env.APP_VERSION }},enable=true | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: | | ||
linux/amd64 | ||
linux/arm64/v8 | ||
push: true | ||
build-args: | | ||
AUTOFILM_VERSION=${{ env.APP_VERSION }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha, scope=${{ github.workflow }}-docker | ||
cache-to: type=gha, scope=${{ github.workflow }}-docker |
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