summaryrefslogtreecommitdiff
path: root/.github/workflows/docker-main.yml
blob: 92e51b54f7945189feb9cbefbf91b74bdbe27d58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Docker Main Build
on:
  push:
    branches: [ main ]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  docker-main-build:
    runs-on: ubuntu-latest
    steps:
    - name: Set up QEMU
      uses: docker/setup-qemu-action@v3.6.0
    - name: Set up Docker Buildx
      id: buildx
      uses: docker/setup-buildx-action@v3.10.0
      with:
        version: v0.19.3
        driver-opts: |
          image=moby/buildkit:buildx-stable-1
          network=host
    - uses: actions/checkout@v4
      with:
        fetch-depth: 0
    - name: Login to GHCR
      uses: docker/login-action@v3.3.0
      with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
    - name: Login to DockerHub
      uses: docker/login-action@v3.3.0
      with:
          # NOTE: DOCKERHUB_TOKEN and DOCKERHUB_USERNAME must be present in https://github.com/hairyhenderson/gomplate/settings
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
    - name: Build & Push (latest tag)
      run: |
        export srcrepo=ghcr.io/${{ github.repository}}
        make docker-multi COMMIT=${{ github.sha }} DOCKER_REPO=${srcrepo} BUILDX_ACTION=--push

        for repo in "gomplate/gomplate" "hairyhenderson/gomplate"; do
          docker buildx imagetools create -t ${repo}:latest ${srcrepo}:latest
          docker buildx imagetools create -t ${repo}:alpine ${srcrepo}:alpine
        done