Merge pull request #2114 from makelinux/ensure_server #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |