From efab2b7082f3cc5f6746404f9e493b91f7abcf05 Mon Sep 17 00:00:00 2001 From: chengscai Date: Fri, 7 Jun 2024 17:28:05 +0800 Subject: [PATCH] feat: github action add workflow --- .github/workflows/build_docker.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/build_docker.yml diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml new file mode 100644 index 0000000..95917b0 --- /dev/null +++ b/.github/workflows/build_docker.yml @@ -0,0 +1,27 @@ +name: Build and Push Docker Image to Alibaba Cloud + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Login to Alibaba Cloud Container Registry + env: + DOCKER_REGISTRY: ${{ secrets.ALICLOUD_REGISTRY }} + DOCKER_USERNAME: ${{ secrets.ALICLOUD_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.ALICLOUD_PASSWORD }} + run: | + echo $DOCKER_PASSWORD | docker login --username=$DOCKER_USERNAME --password-stdin $DOCKER_REGISTRY + - name: Build Docker image + run: docker build -t ${{ secrets.ALICLOUD_REGISTRY }}/ss1917/codo-gateway:latest . + + - name: Push Docker image + run: docker push ${{ secrets.ALICLOUD_REGISTRY }}/ss1917/codo-gateway:latest