From d1cac8e25d7b0ed4cd245029ae4f7dfb169f1537 Mon Sep 17 00:00:00 2001 From: Quentin Bourgerie Date: Tue, 14 Mar 2023 17:11:50 +0100 Subject: [PATCH] chore(ci/compiler): Fixing build and push compiler docker images --- .../compiler_publish_docker_images.yml | 27 ++++++++++++------- .../builders/Dockerfile.keysetcache-env | 2 -- .../Dockerfile.concrete-compiler-env | 6 ++--- .../builders => docker}/Dockerfile.cuda-env | 0 .../builders => docker}/Dockerfile.hpx-env | 0 5 files changed, 20 insertions(+), 15 deletions(-) delete mode 100644 compilers/concrete-compiler/builders/Dockerfile.keysetcache-env rename {compilers/concrete-compiler/builders => docker}/Dockerfile.concrete-compiler-env (95%) rename {compilers/concrete-compiler/builders => docker}/Dockerfile.cuda-env (100%) rename {compilers/concrete-compiler/builders => docker}/Dockerfile.hpx-env (100%) diff --git a/.github/workflows/compiler_publish_docker_images.yml b/.github/workflows/compiler_publish_docker_images.yml index 4c0ce8c8f..2ff195e49 100644 --- a/.github/workflows/compiler_publish_docker_images.yml +++ b/.github/workflows/compiler_publish_docker_images.yml @@ -27,6 +27,9 @@ concurrency: group: compiler_publish_docker_images-${{ github.ref }} cancel-in-progress: true +env: + THIS_FILE: .github/workflows/compiler_publish_docker_images.yml + jobs: BuildAndPushDockerImages: needs: [BuildAndPublishHPXDockerImage, BuildAndPublishCUDADockerImage] @@ -37,7 +40,7 @@ jobs: include: - name: test-env image: ghcr.io/zama-ai/concrete-compiler - dockerfile: builders/Dockerfile.concrete-compiler-env + dockerfile: docker/Dockerfile.concrete-compiler-env steps: - name: Instance configuration used @@ -80,7 +83,7 @@ jobs: BuildAndPublishHPXDockerImage: name: Build & Publish HPX Docker Image - runs-on: ubuntu-20.04 + runs-on: ${{ github.event.inputs.runner_name }} env: IMAGE: ghcr.io/zama-ai/hpx @@ -89,25 +92,28 @@ jobs: with: fetch-depth: 0 + - name: Set up env + run: | + echo "HOME=/home/ubuntu" >> "${GITHUB_ENV}" + - 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.hpx-env') || contains(steps.changed-files.outputs.modified_files, env.THIS_FILE) + if: contains(steps.changed-files.outputs.modified_files, 'docker/Dockerfile.hpx-env') || contains(steps.changed-files.outputs.modified_files, env.THIS_FILE) 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: | - cd compilers/concrete-compiler - docker build -t "${IMAGE}" -f builders/Dockerfile.hpx-env . + docker build -t "${IMAGE}" -f docker/Dockerfile.hpx-env . docker push "${IMAGE}:latest" BuildAndPublishCUDADockerImage: name: Build & Publish CUDA Docker Image - runs-on: ubuntu-20.04 + runs-on: ${{ github.event.inputs.runner_name }} env: IMAGE: ghcr.io/zama-ai/cuda TAG: "11-7" @@ -117,20 +123,23 @@ jobs: with: fetch-depth: 0 + - name: Set up env + run: | + echo "HOME=/home/ubuntu" >> "${GITHUB_ENV}" + - 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') || contains(steps.changed-files.outputs.modified_files, env.THIS_FILE) + if: contains(steps.changed-files.outputs.modified_files, 'docker/Dockerfile.cuda-env') || contains(steps.changed-files.outputs.modified_files, env.THIS_FILE) 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: | - cd compilers/concrete-compiler - docker build -t "${IMAGE}" -f builders/Dockerfile.cuda-env . + docker build -t "${IMAGE}" -f docker/Dockerfile.cuda-env . docker image tag "${IMAGE}" "${IMAGE}:${TAG}" docker push "${IMAGE}:latest" docker push "${IMAGE}:${TAG}" diff --git a/compilers/concrete-compiler/builders/Dockerfile.keysetcache-env b/compilers/concrete-compiler/builders/Dockerfile.keysetcache-env deleted file mode 100644 index 2b1b8d5ec..000000000 --- a/compilers/concrete-compiler/builders/Dockerfile.keysetcache-env +++ /dev/null @@ -1,2 +0,0 @@ -FROM alpine:latest -COPY KeySetCache /KeySetCache diff --git a/compilers/concrete-compiler/builders/Dockerfile.concrete-compiler-env b/docker/Dockerfile.concrete-compiler-env similarity index 95% rename from compilers/concrete-compiler/builders/Dockerfile.concrete-compiler-env rename to docker/Dockerfile.concrete-compiler-env index 8c8fdb11a..5585512cd 100644 --- a/compilers/concrete-compiler/builders/Dockerfile.concrete-compiler-env +++ b/docker/Dockerfile.concrete-compiler-env @@ -36,11 +36,9 @@ RUN ln -s /opt/python/${python_tag}/bin/python /bin/python ENV PYTHON_EXEC=/opt/python/${python_tag}/bin/python # Install python deps RUN pip install numpy pybind11==2.8 PyYAML pytest wheel auditwheel -# Setup LLVM -COPY /llvm-project /llvm-project # Setup and build compiler -COPY /compiler /compiler -WORKDIR /compiler +COPY / /workdir +WORKDIR /workdir/compilers/concrete-compiler/compiler RUN mkdir -p /build RUN --mount=type=ssh make DATAFLOW_EXECUTION_ENABLED=ON BUILD_DIR=/build CCACHE=ON \ Python3_EXECUTABLE=${PYTHON_EXEC} \ diff --git a/compilers/concrete-compiler/builders/Dockerfile.cuda-env b/docker/Dockerfile.cuda-env similarity index 100% rename from compilers/concrete-compiler/builders/Dockerfile.cuda-env rename to docker/Dockerfile.cuda-env diff --git a/compilers/concrete-compiler/builders/Dockerfile.hpx-env b/docker/Dockerfile.hpx-env similarity index 100% rename from compilers/concrete-compiler/builders/Dockerfile.hpx-env rename to docker/Dockerfile.hpx-env