From 6b3f9fde10fdc90760e2bee40408d6f83f42d766 Mon Sep 17 00:00:00 2001 From: vvanglro <947001731@qq.com> Date: Fri, 9 Dec 2022 11:33:21 +0800 Subject: [PATCH] feat: auto build and push docker image --- .github/workflows/docker-image.yml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..336208f --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,36 @@ +name: Publish Docker image + +on: + push: + tags: + - '*' + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-20.04 + + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: vvanglro/cf-clearance + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file