]>
Commit | Line | Data |
---|---|---|
f3fbbf01 C |
1 | name: Docker |
2 | ||
3 | on: | |
4 | push: | |
5 | branches: | |
6 | - 'master' | |
7 | schedule: | |
8 | - cron: '0 3 * * *' | |
9 | ||
10 | jobs: | |
11 | generate-matrix: | |
12 | name: Generate matrix for Docker build | |
13 | runs-on: ubuntu-latest | |
14 | outputs: | |
15 | matrix: ${{ steps.set-matrix.outputs.matrix }} | |
16 | steps: | |
17 | - name: Checkout | |
388a31d2 | 18 | uses: actions/checkout@v3 |
f3fbbf01 C |
19 | with: |
20 | ref: master | |
21 | - name: Set matrix for build | |
22 | id: set-matrix | |
23 | run: | | |
24 | # FIXME: https://github.com/actions/checkout/issues/290 | |
25 | git fetch --force --tags | |
26 | ||
ebd61437 C |
27 | one="{ \"file\": \"./support/docker/production/Dockerfile.bullseye\", \"ref\": \"develop\", \"tags\": \"chocobozzz/peertube:develop-bullseye\" }" |
28 | two="{ \"file\": \"./support/docker/production/Dockerfile.bullseye\", \"ref\": \"master\", \"tags\": \"chocobozzz/peertube:production-bullseye,chocobozzz/peertube:$(git describe --abbrev=0)-bullseye\" }" | |
29 | three="{ \"file\": \"./support/docker/production/Dockerfile.nginx\", \"ref\": \"master\", \"tags\": \"chocobozzz/peertube-webserver:latest\" }" | |
f3fbbf01 | 30 | |
ebd61437 | 31 | matrix="[$one,$two,$three]" |
a47bbfcc | 32 | echo "matrix={\"include\":$matrix}" >> $GITHUB_OUTPUT |
f3fbbf01 C |
33 | |
34 | docker: | |
35 | runs-on: ubuntu-latest | |
36 | ||
37 | needs: generate-matrix | |
38 | ||
39 | strategy: | |
40 | matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} | |
41 | fail-fast: false | |
42 | ||
7853a425 C |
43 | name: ${{ matrix.tags }} |
44 | ||
f3fbbf01 C |
45 | steps: |
46 | - | |
47 | name: Set up QEMU | |
3a58ab45 | 48 | uses: docker/setup-qemu-action@v2 |
f3fbbf01 C |
49 | - |
50 | name: Set up Docker Buildx | |
3a58ab45 | 51 | uses: docker/setup-buildx-action@v2 |
f3fbbf01 C |
52 | - |
53 | name: Login to DockerHub | |
3a58ab45 | 54 | uses: docker/login-action@v2 |
f3fbbf01 C |
55 | with: |
56 | username: ${{ secrets.DOCKERHUB_USERNAME }} | |
57 | password: ${{ secrets.DOCKERHUB_TOKEN }} | |
58 | ||
59 | - | |
60 | name: Checkout develop | |
388a31d2 | 61 | uses: actions/checkout@v3 |
f3fbbf01 C |
62 | with: |
63 | ref: ${{ matrix.ref }} | |
64 | - | |
65 | name: Docker build | |
3a58ab45 | 66 | uses: docker/build-push-action@v3 |
f3fbbf01 C |
67 | with: |
68 | context: '.' | |
ebd61437 | 69 | platforms: linux/amd64,linux/arm64 |
f3fbbf01 C |
70 | push: true |
71 | file: ${{ matrix.file }} | |
72 | tags: ${{ matrix.tags }} |