Skip to content

Commit

Permalink
Merge pull request #1 from a645162/dev
Browse files Browse the repository at this point in the history
feat(CI/CD): Build Docker Image
  • Loading branch information
a645162 authored Sep 11, 2024
2 parents 206f7e5 + 250a635 commit dcb50f1
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/docker-publish.yml
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 }}

0 comments on commit dcb50f1

Please sign in to comment.