master
yml 141 lines 4.58 KB
Raw
1 name: Docker-Builder-Debian
2
3 on:
4 workflow_dispatch:
5 schedule:
6 - cron: '0 1 * * *' # Daily at 01:00 UTC (I think)
7 release:
8 types: [ published ]
9
10 permissions:
11 contents: read
12 packages: write
13 actions: write
14
15 jobs:
16 prepare:
17 runs-on: ubuntu-latest
18 name: Run Translations
19 steps:
20 - name: Checkout repository
21 uses: actions/checkout@v5
22 - name: Set up Node.js
23 uses: actions/setup-node@v6
24 with:
25 node-version: "24.x"
26 - name: Run translate.js (ignore errors)
27 run: node translate.js || true
28 working-directory: translate
29 - name: Run translate extractall
30 run: node translate extractall
31 working-directory: translate
32 - name: Run translate.js minifyall
33 run: node translate.js minifyall
34 working-directory: translate
35 - name: Run translate.js translateall
36 run: node translate.js translateall
37 working-directory: translate
38 - name: Upload repo with translations
39 uses: actions/upload-artifact@v5
40 with:
41 name: repo-with-preparations
42 path: ./
43 build-images:
44 runs-on: ubuntu-latest
45 needs: prepare
46 strategy:
47 fail-fast: false
48 max-parallel: 5
49 matrix:
50 include:
51 - variant: mongodb
52 suffix: -mongodb-debian
53 postgresql: false
54 mongodb: true
55 mariadb: false
56 - variant: postgresql
57 suffix: -postgresql-debian
58 postgresql: true
59 mongodb: false
60 mariadb: false
61 - variant: mariadb
62 suffix: -mariadb-debian
63 postgresql: false
64 mongodb: false
65 mariadb: true
66 - variant: complete
67 suffix: -debian
68 postgresql: true
69 mongodb: true
70 mariadb: true
71 - variant: slim
72 suffix: -slim-debian
73 postgresql: false
74 mongodb: false
75 mariadb: false
76 name: Build Docker Image (${{ matrix.variant }})
77 steps:
78 - name: Download repo artifact
79 uses: actions/download-artifact@v5
80 with:
81 name: repo-with-preparations
82 - name: Set up QEMU
83 uses: docker/setup-qemu-action@v3
84 with:
85 cache-image: false
86 platforms: linux/amd64,linux/arm64,linux/arm/v7
87 - name: Set up Docker Buildx
88 uses: docker/setup-buildx-action@v3
89 with:
90 cache-binary: false
91 - name: Log in to GitHub Container Registry
92 uses: docker/login-action@v3
93 with:
94 registry: ghcr.io
95 username: ${{ github.repository_owner }}
96 password: ${{ secrets.GITHUB_TOKEN }}
97 - name: Log in to Docker Hub
98 uses: docker/login-action@v3
99 with:
100 username: ${{ secrets.DOCKER_USERNAME }}
101 password: ${{ secrets.DOCKER_PASSWORD }}
102 - name: compile metadata information
103 id: meta
104 uses: docker/metadata-action@v5
105 with:
106 images: |
107 ghcr.io/${{ github.repository_owner }}/meshcentral
108 docker.io/${{ secrets.DOCKER_USERNAME }}/meshcentral
109 flavor: |
110 latest=false
111 tags: |
112 type=ref,event=branch,suffix=${{ matrix.suffix }}
113 type=ref,event=tag,suffix=${{ matrix.suffix }}
114 type=raw,value=latest,enable=${{startsWith(github.ref, 'refs/tags/') && matrix.variant != 'complete'}},suffix=${{ matrix.suffix }}
115 type=raw,value=latest-debian,enable=${{startsWith(github.ref, 'refs/tags/') && matrix.variant == 'complete'}}
116 - name: Build and push Docker image (${{ matrix.variant }}
117 uses: docker/build-push-action@v6
118 with:
119 push: ${{ github.event_name != 'pull_request' }}
120 context: .
121 file: ./docker/Dockerfile-debian
122 tags: ${{ steps.meta.outputs.tags }}
123 labels: ${{ steps.meta.outputs.labels }}
124 platforms: linux/amd64,linux/arm64,linux/arm/v7
125 build-args: |
126 DISABLE_MINIFY=yes
127 DISABLE_TRANSLATE=yes
128 DISABLE_EXTRACT=yes
129 INCLUDE_MONGODB_TOOLS=${{ matrix.mongodb }}
130 INCLUDE_POSTGRESQL_TOOLS=${{ matrix.postgresql }}
131 INCLUDE_MARIADB_TOOLS=${{ matrix.mariadb }}
132 rerun-on-failure:
133 needs: build-images
134 if: failure() && fromJSON(github.run_attempt) < 3
135 runs-on: ubuntu-latest
136 steps:
137 - env:
138 GH_REPO: ${{ github.repository }}
139 GH_TOKEN: ${{ github.token }}
140 GH_DEBUG: api
141 run: gh workflow run rerun.yaml -r ${{ github.head_ref || github.ref_name }} -F run_id=${{ github.run_id }}