Skip to content

Commit 0676451

Browse files
author
matatonic
committed
free up space on github runner
1 parent c86eb4c commit 0676451

File tree

1 file changed

+33
-192
lines changed

1 file changed

+33
-192
lines changed

.github/workflows/build-docker.yml

+33-192
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
types: [published]
1010

1111
jobs:
12-
build-and-push-image-amd64:
12+
build-and-push-image:
1313
runs-on: ubuntu-latest
1414

1515
permissions:
@@ -26,65 +26,14 @@ jobs:
2626
- name: Check out code
2727
uses: actions/checkout@v4
2828

29-
- name: Set up Docker Buildx
30-
uses: docker/setup-buildx-action@v2
31-
with:
32-
install: true
33-
34-
# Log in to the GitHub Container Registry only when not running on a pull request event
35-
- name: Login to Docker Registry
36-
uses: docker/login-action@v2
37-
with:
38-
registry: ${{ env.DOCKER_REGISTRY }}
39-
username: ${{ github.actor }}
40-
password: ${{ secrets.GITHUB_TOKEN }}
41-
42-
- name: Extract metadata (tags, labels) for Docker
43-
id: meta
44-
uses: docker/metadata-action@v4
45-
with:
46-
images: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}
47-
48-
# Build and push the Docker image to GHCR for the main branch or specific tags
49-
- name: Build and Push Docker Image
50-
if: github.ref == 'refs/heads/main'
51-
uses: docker/build-push-action@v4
52-
with:
53-
context: .
54-
file: Dockerfile
55-
push: true
56-
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
57-
labels: version=${{ github.run_id }}
58-
platforms: linux/amd64
59-
60-
# For tagged releases, build and push the Docker image with the corresponding tag
61-
- name: Build and Push Docker Image (Tagged)
62-
if: startsWith(github.ref, 'refs/tags/')
63-
uses: docker/build-push-action@v4
64-
with:
65-
context: .
66-
file: Dockerfile
67-
push: true
68-
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
69-
labels: version=${{ github.run_id }}
70-
platforms: linux/amd64
71-
72-
build-and-push-image-arm64:
73-
runs-on: ubuntu-latest
74-
75-
permissions:
76-
contents: read
77-
packages: write
78-
79-
env:
80-
# Set up environment variables for the job
81-
DOCKER_REGISTRY: ghcr.io
82-
IMAGE_NAME: ${{ github.repository }}
83-
TAG: ${{ github.sha }}
84-
85-
steps:
86-
- name: Check out code
87-
uses: actions/checkout@v4
29+
- name: Free Disk Space Before Build
30+
run: |
31+
sudo rm -rf /usr/local/.ghcup
32+
sudo rm -rf /opt/hostedtoolcache/CodeQL
33+
sudo rm -rf /usr/local/lib/android
34+
sudo rm -rf /usr/share/dotnet
35+
sudo rm -rf /opt/ghc
36+
sudo rm -rf /usr/local/share/boost
8837
8938
- name: Set up Docker Buildx
9039
uses: docker/setup-buildx-action@v2
@@ -115,7 +64,7 @@ jobs:
11564
push: true
11665
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
11766
labels: version=${{ github.run_id }}
118-
platforms: linux/arm64
67+
platforms: linux/amd64,linux/arm64
11968

12069
# For tagged releases, build and push the Docker image with the corresponding tag
12170
- name: Build and Push Docker Image (Tagged)
@@ -127,9 +76,9 @@ jobs:
12776
push: true
12877
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
12978
labels: version=${{ github.run_id }}
130-
platforms: linux/arm64
79+
platforms: linux/amd64,linux/arm64
13180

132-
build-and-push-min-image-amd64:
81+
build-and-push-image-min:
13382
runs-on: ubuntu-latest
13483

13584
permissions:
@@ -146,65 +95,14 @@ jobs:
14695
- name: Check out code
14796
uses: actions/checkout@v4
14897

149-
- name: Set up Docker Buildx
150-
uses: docker/setup-buildx-action@v2
151-
with:
152-
install: true
153-
154-
# Log in to the GitHub Container Registry only when not running on a pull request event
155-
- name: Login to Docker Registry
156-
uses: docker/login-action@v2
157-
with:
158-
registry: ${{ env.DOCKER_REGISTRY }}
159-
username: ${{ github.actor }}
160-
password: ${{ secrets.GITHUB_TOKEN }}
161-
162-
- name: Extract metadata (tags, labels) for Docker
163-
id: meta
164-
uses: docker/metadata-action@v4
165-
with:
166-
images: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}
167-
168-
# Build and push the Docker image to GHCR for the main branch or specific tags
169-
- name: Build and Push Docker Image
170-
if: github.ref == 'refs/heads/main'
171-
uses: docker/build-push-action@v4
172-
with:
173-
context: .
174-
file: Dockerfile.min
175-
push: true
176-
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
177-
labels: version=${{ github.run_id }}
178-
platforms: linux/amd64
179-
180-
# For tagged releases, build and push the Docker image with the corresponding tag
181-
- name: Build and Push Docker Image (Tagged)
182-
if: startsWith(github.ref, 'refs/tags/')
183-
uses: docker/build-push-action@v4
184-
with:
185-
context: .
186-
file: Dockerfile.min
187-
push: true
188-
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
189-
labels: version=${{ github.run_id }}
190-
platforms: linux/amd64
191-
192-
build-and-push-min-image-arm64:
193-
runs-on: ubuntu-latest
194-
195-
permissions:
196-
contents: read
197-
packages: write
198-
199-
env:
200-
# Set up environment variables for the job
201-
DOCKER_REGISTRY: ghcr.io
202-
IMAGE_NAME: ${{ github.repository }}-min
203-
TAG: ${{ github.sha }}
204-
205-
steps:
206-
- name: Check out code
207-
uses: actions/checkout@v4
98+
- name: Free Disk Space Before Build
99+
run: |
100+
sudo rm -rf /usr/local/.ghcup
101+
sudo rm -rf /opt/hostedtoolcache/CodeQL
102+
sudo rm -rf /usr/local/lib/android
103+
sudo rm -rf /usr/share/dotnet
104+
sudo rm -rf /opt/ghc
105+
sudo rm -rf /usr/local/share/boost
208106
209107
- name: Set up Docker Buildx
210108
uses: docker/setup-buildx-action@v2
@@ -235,7 +133,7 @@ jobs:
235133
push: true
236134
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
237135
labels: version=${{ github.run_id }}
238-
platforms: linux/arm64
136+
platforms: linux/amd64,linux/arm64
239137

240138
# For tagged releases, build and push the Docker image with the corresponding tag
241139
- name: Build and Push Docker Image (Tagged)
@@ -247,9 +145,9 @@ jobs:
247145
push: true
248146
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
249147
labels: version=${{ github.run_id }}
250-
platforms: linux/arm64
148+
platforms: linux/amd64,linux/arm64
251149

252-
build-and-push-rocm-image-amd64:
150+
build-and-push-image-rocm:
253151
runs-on: ubuntu-latest
254152

255153
permissions:
@@ -267,70 +165,14 @@ jobs:
267165
- name: Check out code
268166
uses: actions/checkout@v4
269167

270-
- name: Set up Docker Buildx
271-
uses: docker/setup-buildx-action@v2
272-
with:
273-
install: true
274-
275-
# Log in to the GitHub Container Registry only when not running on a pull request event
276-
- name: Login to Docker Registry
277-
uses: docker/login-action@v2
278-
with:
279-
registry: ${{ env.DOCKER_REGISTRY }}
280-
username: ${{ github.actor }}
281-
password: ${{ secrets.GITHUB_TOKEN }}
282-
283-
- name: Extract metadata (tags, labels) for Docker
284-
id: meta
285-
uses: docker/metadata-action@v4
286-
with:
287-
images: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}
288-
289-
# Build and push the Docker image to GHCR for the main branch or specific tags
290-
- name: Build and Push Docker Image
291-
if: github.ref == 'refs/heads/main'
292-
uses: docker/build-push-action@v4
293-
with:
294-
context: .
295-
file: Dockerfile
296-
push: true
297-
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
298-
labels: version=${{ github.run_id }}
299-
platforms: linux/amd64
300-
build-args: |
301-
USE_ROCM=1
302-
303-
# For tagged releases, build and push the Docker image with the corresponding tag
304-
- name: Build and Push Docker Image (Tagged)
305-
if: startsWith(github.ref, 'refs/tags/')
306-
uses: docker/build-push-action@v4
307-
with:
308-
context: .
309-
file: Dockerfile
310-
push: true
311-
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
312-
labels: version=${{ github.run_id }}
313-
platforms: linux/amd64
314-
build-args: |
315-
USE_ROCM=1
316-
317-
build-and-push-rocm-image-arm64:
318-
runs-on: ubuntu-latest
319-
320-
permissions:
321-
contents: read
322-
packages: write
323-
324-
env:
325-
# Set up environment variables for the job
326-
USE_ROCM: 1
327-
DOCKER_REGISTRY: ghcr.io
328-
IMAGE_NAME: ${{ github.repository }}-rocm
329-
TAG: ${{ github.sha }}
330-
331-
steps:
332-
- name: Check out code
333-
uses: actions/checkout@v4
168+
- name: Free Disk Space Before Build
169+
run: |
170+
sudo rm -rf /usr/local/.ghcup
171+
sudo rm -rf /opt/hostedtoolcache/CodeQL
172+
sudo rm -rf /usr/local/lib/android
173+
sudo rm -rf /usr/share/dotnet
174+
sudo rm -rf /opt/ghc
175+
sudo rm -rf /usr/local/share/boost
334176
335177
- name: Set up Docker Buildx
336178
uses: docker/setup-buildx-action@v2
@@ -361,7 +203,7 @@ jobs:
361203
push: true
362204
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
363205
labels: version=${{ github.run_id }}
364-
platforms: linux/arm64
206+
platforms: linux/amd64,linux/arm64
365207
build-args: |
366208
USE_ROCM=1
367209
@@ -375,7 +217,6 @@ jobs:
375217
push: true
376218
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
377219
labels: version=${{ github.run_id }}
378-
platforms: linux/arm64
220+
platforms: linux/amd64,linux/arm64
379221
build-args: |
380222
USE_ROCM=1
381-

0 commit comments

Comments
 (0)