Build and Push Docker Image #6
This file contains hidden or 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: Build and Push Docker Image | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| service: | |
| description: "Select the service to build" | |
| required: true | |
| type: choice | |
| options: | |
| - gateway | |
| - user | |
| - assistant | |
| - commodity | |
| - cart | |
| - order | |
| - payment | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out the code | |
| uses: actions/checkout@v4 | |
| - name: Log in to Alibaba Cloud Docker Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ secrets.ALIYUN_DOCKER_REGISTRY }} | |
| username: ${{ secrets.ALIYUN_DOCKER_USER }} | |
| password: ${{ secrets.ALIYUN_DOCKER_PASSWORD }} | |
| - name: Ensure build script is executable | |
| run: chmod +x ./hack/image-build-and-push.sh | |
| - name: Convert service name to lowercase | |
| run: echo "SERVICE=$(echo '${{ github.event.inputs.service }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
| - name: Build and Push Docker Image | |
| run: | | |
| cd $GITHUB_WORKSPACE && bash ./hack/image-build-and-push.sh $SERVICE |