增加算想云java部分的github action的CI (#417) #1
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
name: CPodManager-CI | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- 'cmd/**.go' | |
- 'deployment/**Dockerfile' | |
env: | |
DOCKERHUB_REPO: registry.cn-beijing.aliyuncs.com | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.21.1' | |
- name: Generate image tag | |
run: echo COMMIT_ID=`git rev-parse --short HEAD` >> $GITHUB_ENV | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.DOCKERHUB_REPO }} | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and Push images | |
run: | | |
go build -tags netgo -o cpodmanager ./cmd/cpodmanager/cpodmanager.go | |
go build -tags netgo -o modeluploadjob ./cmd/modeluploader/modeluploadjob.go | |
docker build --tag ${{ env.DOCKERHUB_REPO }}/sxwl-ai/cpodmanager:${{ env.COMMIT_ID }} --file ./deployment/cpodmanager/Dockerfile . | |
docker build --tag ${{ env.DOCKERHUB_REPO }}/sxwl-ai/modeluploader:${{ env.COMMIT_ID }} --file ./deployment/modeluploader/Dockerfile . | |
docker push ${{ env.DOCKERHUB_REPO }}/sxwl-ai/cpodmanager:${{ env.COMMIT_ID }} | |
docker push ${{ env.DOCKERHUB_REPO }}/sxwl-ai/modeluploader:${{ env.COMMIT_ID }} |