-
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.
Merge pull request #1 from a645162/dev
feat(CI/CD): Build Docker Image
- Loading branch information
Showing
1 changed file
with
86 additions
and
0 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,86 @@ | ||
name: Docker Image Stable Newest CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
build-docker-image-latest-main: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: Check Version Setting | ||
run: | | ||
python --version | ||
pip --version | ||
- name: Build .jar file | ||
run: python build_with_docker.py | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker BuildX | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Set up Aliyun Region | ||
env: | ||
ACR_REGION: cn-shanghai | ||
run: | | ||
echo "ACR_REGION=$ACR_REGION" >> $GITHUB_ENV | ||
echo "ACR_REGISTRY=registry.${ACR_REGION}.aliyuncs.com" >> $GITHUB_ENV | ||
- name: Confirm Aliyun ACR | ||
run: | | ||
echo "Aliyun ACR REGION=$ACR_REGION" | ||
echo "Aliyun ACR REGISTRY=$ACR_REGISTRY" | ||
- name: Login to Aliyun Container Registry (ACR) | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.ACR_REGISTRY }} | ||
username: ${{ secrets.ALIYUN_USERNAME }} | ||
password: ${{ secrets.ALIYUN_PASSWORD }} | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | ||
|
||
- name: Set up Image Tags | ||
env: | ||
GITHUB_SHA: ${{ github.sha }} | ||
IMAGE_TAG: latest | ||
run: | | ||
echo "GITHUB_SHA=$GITHUB_SHA" >> $GITHUB_ENV | ||
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV | ||
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV | ||
- name: Build & Push image | ||
id: docker_build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: Docker/Dockerfile | ||
platforms: | ||
linux/amd64, | ||
linux/arm64, | ||
push: true | ||
tags: | | ||
${{ github.repository }}:${{ env.IMAGE_TAG }}, | ||
${{ env.ACR_REGISTRY }}/${{ github.repository }}:${{ env.IMAGE_TAG }}, | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |