ci: provide cuda tools in test docker image

build cuda image and copy cuda tools in test image to reduce its final
size
This commit is contained in:
youben11
2022-12-05 09:30:12 +01:00
committed by Quentin Bourgerie
parent ccb83cc9be
commit 788c4c863d
3 changed files with 51 additions and 2 deletions

View File

@@ -701,8 +701,8 @@ jobs:
#################
BuildAndPushDockerImages:
if: ${{ github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') || needs.BuildAndPublishHPXDockerImage.outputs.image_built == 'true' }}
needs: [BuildAndPublishHPXDockerImage]
if: ${{ github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') || needs.BuildAndPublishHPXDockerImage.outputs.image_built == 'true' || needs.BuildAndPublishCUDADockerImage.outputs.image_built == 'true' }}
needs: [BuildAndPublishHPXDockerImage, BuildAndPublishCUDADockerImage]
name: Build & Publish Docker Images
runs-on: ubuntu-20.04
strategy:
@@ -783,3 +783,38 @@ jobs:
- name: Is Image Built
id: is-built
run: echo "::set-output name=IMAGE_BUILT::${{ contains(steps.changed-files.outputs.modified_files, 'builders/Dockerfile.hpx-env') }}"
BuildAndPublishCUDADockerImage:
name: Build & Publish CUDA Docker Image
runs-on: ubuntu-20.04
env:
IMAGE: ghcr.io/zama-ai/cuda
TAG: "11-7"
outputs:
image_built: ${{ steps.is-built.outputs.IMAGE_BUILT }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v32
- name: Login
id: login
if: contains(steps.changed-files.outputs.modified_files, 'builders/Dockerfile.cuda-env')
run: echo "${{ secrets.GHCR_PASSWORD }}" | docker login -u ${{ secrets.GHCR_LOGIN }} --password-stdin ghcr.io
- name: Build Tag and Publish
if: ${{ steps.login.conclusion != 'skipped' }}
run: |
docker build -t "${IMAGE}" -f builders/Dockerfile.cuda-env .
docker image tag "${IMAGE}" "${IMAGE}:${TAG}"
docker push "${IMAGE}:latest"
docker push "${IMAGE}:${TAG}"
- name: Is Image Built
id: is-built
run: echo "::set-output name=IMAGE_BUILT::${{ contains(steps.changed-files.outputs.modified_files, 'builders/Dockerfile.cuda-env') }}"

View File

@@ -20,6 +20,10 @@ RUN ./bootstrap.sh && ./b2 --with-filesystem install
# Setup HPX
COPY --from=ghcr.io/zama-ai/hpx:latest /hpx /hpx
ENV HPX_INSTALL_DIR=/hpx/build
# Setup CUDA
COPY --from=ghcr.io/zama-ai/cuda:11-7 /usr/local/cuda-11.7/ /usr/local/cuda-11.7/
COPY --from=ghcr.io/zama-ai/cuda:11-7 /usr/lib64/libcuda.so* /usr/lib64/
ENV PATH "$PATH:/usr/local/cuda-11.7/bin"
# Set the python path. Options: [cp37-cp37m, cp38-cp38, cp39-cp39, cp310-cp310]
# Links and env would be available to use the appropriate python version
ARG python_tag=cp38-cp38

View File

@@ -0,0 +1,10 @@
FROM quay.io/pypa/manylinux_2_28_x86_64:2022-11-19-1b19e81
RUN dnf install -y kernel-devel kernel-headers
RUN curl https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda-repo-rhel8-11-7-local-11.7.1_515.65.01-1.x86_64.rpm -o cuda-repo-rhel8-11-7-local-11.7.1_515.65.01-1.x86_64.rpm
RUN rpm -i cuda-repo-rhel8-11-7-local-11.7.1_515.65.01-1.x86_64.rpm
RUN dnf clean all
RUN dnf install -y epel-release
RUN dnf update -y
RUN dnf -y module install nvidia-driver:latest-dkms
RUN dnf -y install cuda