From 5a365e9e867176e16faacc4397212505ad0042de Mon Sep 17 00:00:00 2001 From: yoan <536464346@qq.com> Date: Wed, 28 Aug 2024 01:29:40 +0800 Subject: [PATCH] Add docker support --- .github/workflows/push_image.yml | 36 ++++++++++++++++++++++++++++++++ Dockerfile_build | 1 - 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/push_image.yml diff --git a/.github/workflows/push_image.yml b/.github/workflows/push_image.yml new file mode 100644 index 00000000..9ba9be1e --- /dev/null +++ b/.github/workflows/push_image.yml @@ -0,0 +1,36 @@ +name: Docker Image CI + +on: + push: + branches: ["main"] + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + + with: + registry: registry.cn-shanghai.aliyuncs.com + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile_build + platforms: linux/amd64,linux/arm64 + push: true + tags: registry.cn-shanghai.aliyuncs.com/usual2970/certimate:latest diff --git a/Dockerfile_build b/Dockerfile_build index 1779fac1..63fae28c 100644 --- a/Dockerfile_build +++ b/Dockerfile_build @@ -1,6 +1,5 @@ FROM golang:1.22-alpine -ENV GOPROXY=https://goproxy.cn WORKDIR /app