master
yml 139 lines 4.5 KB
Raw
1 name: Docker-Builder-Alpine
2
3 on:
4 workflow_dispatch:
5 schedule:
6 - cron: '0 0 * * *' # Daily at 00:00 UTC
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
53 postgresql: false
54 mongodb: true
55 mariadb: false
56 - variant: postgresql
57 suffix: -postgresql
58 postgresql: true
59 mongodb: false
60 mariadb: false
61 - variant: mariadb
62 suffix: -mariadb
63 postgresql: false
64 mongodb: false
65 mariadb: true
66 - variant: complete
67 suffix:
68 postgresql: true
69 mongodb: true
70 mariadb: true
71 - variant: slim
72 suffix: -slim
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,linux/arm/v6
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 tags: |
110 type=ref,event=branch,suffix=${{ matrix.suffix }}
111 type=ref,event=tag,suffix=${{ matrix.suffix }}
112 type=raw,value=latest,enable=${{startsWith(github.ref, 'refs/tags/') && matrix.variant != 'complete'}},suffix=${{ matrix.suffix }}
113 type=raw,value=latest,enable=${{startsWith(github.ref, 'refs/tags/') && matrix.variant == 'complete'}}
114 - name: Build and push Docker image (${{ matrix.variant }}
115 uses: docker/build-push-action@v6
116 with:
117 push: ${{ github.event_name != 'pull_request' }}
118 context: .
119 file: ./docker/Dockerfile
120 tags: ${{ steps.meta.outputs.tags }}
121 labels: ${{ steps.meta.outputs.labels }}
122 platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
123 build-args: |
124 DISABLE_MINIFY=yes
125 DISABLE_TRANSLATE=yes
126 DISABLE_EXTRACT=yes
127 INCLUDE_MONGODB_TOOLS=${{ matrix.mongodb }}
128 INCLUDE_POSTGRESQL_TOOLS=${{ matrix.postgresql }}
129 INCLUDE_MARIADB_TOOLS=${{ matrix.mariadb }}
130 rerun-on-failure:
131 needs: build-images
132 if: failure() && fromJSON(github.run_attempt) < 3
133 runs-on: ubuntu-latest
134 steps:
135 - env:
136 GH_REPO: ${{ github.repository }}
137 GH_TOKEN: ${{ github.token }}
138 GH_DEBUG: api
139 run: gh workflow run rerun.yaml -r ${{ github.head_ref || github.ref_name }} -F run_id=${{ github.run_id }}