From f1e579eeef0ae22509dd2d4831b8d9df681853e2 Mon Sep 17 00:00:00 2001 From: yisier <1340976576@qq.com> Date: Fri, 4 Nov 2022 15:23:48 +0800 Subject: [PATCH] Create docker.yml --- .github/workflows/docker.yml | 59 ++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..794a8de --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,59 @@ +# This workflow will build a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + +name: docker + +on: + workflow_dispatch: + release: + types: [published] + branches: [ master ] + +jobs: + build_docker: + + runs-on: ubuntu-latest + steps: + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build and push nps + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile.nps + platforms: linux/amd64,linux/arm,linux/arm64 + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/nps:latest + ${{ secrets.DOCKERHUB_USERNAME }}/nps:${{ env.RELEASE_VERSION }} + - name: Build and push npc + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile.npc + platforms: linux/amd64,linux/arm,linux/arm64 + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/npc:latest + ${{ secrets.DOCKERHUB_USERNAME }}/npc:${{ env.RELEASE_VERSION }} + +