diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml new file mode 100644 index 0000000..d7fd7f6 --- /dev/null +++ b/.github/workflows/docker_build.yml @@ -0,0 +1,26 @@ +name: Docker Image CI + +on: + push: + tags: + - "v*.*.*" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v3 + + - name: Set build tag as env var + run: echo "TAG=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV + + - name: Docker login + run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build the Docker image + run: docker build . --file Dockerfile --tag ${{ secrets.DOCKERHUB_USERNAME }}/blackjackbot:latest --tag ${{ secrets.DOCKERHUB_USERNAME }}/blackjackbot:${{ env.TAG }} + + - name: Push the Docker image + run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/blackjackbot --all-tags