aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build-infra-dockers.yaml
blob: 4ca954bafee70017fadbf50ea7c675e39992224f (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
48
49
50
51
52
53
54
name: Build Infrastructure Images

on:
  push:
    branches:
      - infrastructure

env:
    GO_VERSION: "~1.21.1"
    CGO_ENABLED: "0"
    BUILD_USER: docker
    BUILD_HOST: github.syncthing.net

jobs:

  docker-syncthing:
    name: Build and push Docker images
    runs-on: ubuntu-latest
    environment: docker
    strategy:
        matrix:
            pkg:
                - stcrashreceiver
                - strelaypoolsrv
                - stupgrades
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Login to Docker Hub
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Build binaries
        run: |
          for arch in arm64 amd64; do
            go run build.go -goos linux -goarch "$arch" build ${{ matrix.pkg }}
            mv ${{ matrix.pkg }} ${{ matrix.pkg }}-linux-"$arch"
          done

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Build and push
        uses: docker/build-push-action@v4
        with:
          context: .
          file: ./Dockerfile.${{ matrix.pkg }}
          platforms: linux/amd64,linux/arm64
          push: true
          tags: syncthing/${{ matrix.pkg }}:latest,syncthing/${{ matrix.pkg }}:${{ github.sha }}