1name: Build and Push Docker image
2
3on:
4 push:
5 branches:
6 - main
7
8permissions:
9 contents: write
10
11jobs:
12 docker:
13 runs-on: ubuntu-latest
14 steps:
15 - name: Checkout source
16 uses: actions/checkout@v4
17
18 # Auto Tag: generates next semantic version (v1.0.0, v1.1.0, etc.)
19 - name: Auto Tag
20 id: autotag
21 uses: phish108/autotag-action@v1.1.64
22 with:
23 github-token: ${{ secrets.GITHUB_TOKEN }}
24
25 - name: Log in to Docker Hub
26 uses: docker/login-action@v2
27 with:
28 username: ${{ secrets.DOCKERHUB_USERNAME }}
29 password: ${{ secrets.DOCKERHUB_TOKEN }}
30
31 - name: Set up Docker Buildx
32 uses: docker/setup-buildx-action@v3
33
34 # Multiarch Docker build and push with BOTH version tag and latest
35 - name: Build and push Docker image
36 uses: docker/build-push-action@v5
37 with:
38 context: .
39 push: true
40 platforms: linux/amd64,linux/arm64
41 tags: |
42 ${{ secrets.DOCKERHUB_USERNAME }}/moocup:${{ steps.autotag.outputs.tag }}
43 ${{ secrets.DOCKERHUB_USERNAME }}/moocup:latest