forked from instructlab/instructlab
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (95 loc) · 3.8 KB
/
image-cuda.yml
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# SPDX-License-Identifier: Apache-2.0
name: Test build cuda container image
on:
push:
branches:
- main
paths:
- 'containers/cuda/Containerfile'
- '.github/workflows/image-cuda.yml' # This workflow
pull_request:
branches:
- main
paths:
- 'containers/cuda/Containerfile'
- '.github/workflows/image-cuda.yml' # This workflow
# Note that the current containerfile builds against a git ref.
# It is not built against the current source tree. So, we test
# build the image against `stable` and `main` if the file changes.
jobs:
build_cuda_image_stable:
name: Build CUDA image for stable
runs-on: ubuntu-latest
steps:
- name: "Harden Runner"
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- name: "Checkout"
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Free disk space
uses: ./.github/actions/free-disk-space
- uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Extract metadata (tags, labels) for gotbot image
id: gobot_meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: |
ghcr.io/${{ github.repository }}/instructlab-cuda
- name: Build and push gobot image
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
with:
context: .
platforms: linux/amd64
build-args: |
GIT_TAG=stable
push: false
tags: ${{ steps.gobot_meta.outputs.tags }}
labels: ${{ steps.gobot_meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
file: containers/cuda/Containerfile
build_cuda_image_main:
name: Build CUDA image for main
runs-on: ubuntu-latest
steps:
- name: "Harden Runner"
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- name: Free disk space
run: |
df -h
sudo docker rmi "$(docker image ls -aq)" >/dev/null 2>&1 || true
sudo rm -rf \
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
/usr/lib/jvm || true
sudo apt install aptitude -y >/dev/null 2>&1
sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1
sudo apt-get autoremove -y >/dev/null 2>&1
sudo apt-get autoclean -y >/dev/null 2>&1
df -h
- name: "Checkout"
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Extract metadata (tags, labels) for gotbot image
id: gobot_meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: |
ghcr.io/${{ github.repository }}/instructlab-cuda
- name: Build and push gobot image
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
with:
context: .
platforms: linux/amd64
build-args: |
GIT_TAG=main
push: false
tags: ${{ steps.gobot_meta.outputs.tags }}
labels: ${{ steps.gobot_meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
file: containers/cuda/Containerfile