diff --git a/.github/workflows/actions-runner-builder.yml b/.github/workflows/actions-runner-builder.yml index 6a0896a..4abcf55 100644 --- a/.github/workflows/actions-runner-builder.yml +++ b/.github/workflows/actions-runner-builder.yml @@ -1,35 +1,37 @@ name: Build scilus/actions-runner image on: - workflow_dispatch: - schedule: - - cron: "0 2 * * *" # Runs at 02:00 every day + workflow_dispatch: + schedule: + - cron: "0 7 * * *" # Runs at 02:00-EST (7:00-UTC) every day jobs: - build-action-runner: - runs-on: ubuntu-latest + compute-dependencies-versions: + runs-on: scilus-org-runners + outputs: + runner_current_version: ${{ steps.github-runner.outputs.current_version }} + runner_latest_version: ${{ steps.github-runner.outputs.latest_version }} - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + steps: + - uses: ksivamuthu/actions-setup-gh-cli@v3 + # From : https://github.com/actions/actions-runner-controller/blob/0bfa57ac504dfc818128f7185fc82830cbdb83f1/.github/workflows/arc-update-runners-scheduled.yaml#L14 + - name: actions-runner version + id: github-runner + env: + GH_TOKEN: ${{ github.token }} + run: | + CURRENT_VERSION=$(echo -n $(cat /VERSION | grep 'runner =>' | cut -d '>' -f2 | tr -d '\n' | tr -d ' ')) + LATEST_VERSION=$(gh release list --exclude-drafts --exclude-pre-releases --limit 1 -R actions/runner | grep -oP '(?<=v)[0-9.]+' | head -1) + echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT + echo "latest_version=$LATEST_VERSION" >> $GITHUB_OUTPUT - - name: VTK version - id: vtk-version - run: | - version=$(cat versioning.hcl | grep vtk-version | sed 's/vtk-version="\(.*\)"/\1/') - echo "::set-output name=version::$version" - - - name: actions-runner version - id: github-runner - uses: docker://ghcr.io/scilus/actions-runner:latest - with: - entrypoint: /bin/bash - args: -c "echo ::set-output name=version::$(cat /version.txt)" - - - name: build - uses: ./docker-builder.yml - with: - target: actions-runner - tag: ${{ steps.github-runner.outputs.version }}-vtk${{ steps.vtk-version.outputs.version }} - update-latest: true - disable-builddate-tag: true - actions-runner-version: ${{ steps.github-runner.outputs.version }} + build-runner-image: + needs: [compute-dependencies-versions] + if: ${{ needs.compute-dependencies-versions.outputs.runner_current_version != needs.compute-dependencies-versions.outputs.runner_latest_version }} + uses: ./.github/workflows/docker-builder.yml + with: + target: actions-runner + update-latest: true + disable-builddate-tag: true + actions-runner-version: ${{ needs.compute-dependencies-versions.outputs.runner_latest_version }} + secrets: inherit diff --git a/.github/workflows/docker-builder.yml b/.github/workflows/docker-builder.yml index 027839c..f707a60 100644 --- a/.github/workflows/docker-builder.yml +++ b/.github/workflows/docker-builder.yml @@ -60,7 +60,7 @@ on: required: true type: string tag: - required: true + required: false type: string update-latest: required: false @@ -135,8 +135,7 @@ on: jobs: build-container: - runs-on: - group: scilus-docker-builders + runs-on: scilus-docker-builders steps: - name: Validate input parameters @@ -147,7 +146,7 @@ jobs: fi - name: Checkout build system - uses: actions/checkout@v3 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: repository: ${{ github.repository_owner }}/containers-scilus ref: ${{ inputs.build-system-ref }} @@ -156,34 +155,72 @@ jobs: id: local-versioning run: | touch local-versioning.hcl + version () { if [ -n "$1" ]; then echo "${2}=\"${1}\"" >> local-versioning.hcl; fi } + echo "dockerhub-user-pull=\"${{ secrets.DOCKER_USERNAME }}\"" >> local-versioning.hcl echo "dockerhub-user-push=\"${{ secrets.DOCKER_USERNAME }}\"" >> local-versioning.hcl - [ -z "${{ inputs.scilpy-version }}" ] || echo "scilpy-version=\"${{ inputs.scilpy-version }}\"" >> local-versioning.hcl - [ -z "${{ inputs.dmriqcpy-version }}" ] || echo "dmriqcpy-version=\"${{ inputs.dmriqcpy-version }}\"" >> local-versioning.hcl - [ -z "${{ inputs.nextflow-version }}" ] || echo "nextflow-version=\"${{ inputs.nextflow-version }}\"" >> local-versioning.hcl - [ -z "${{ inputs.tractoflow-version }}" ] || echo "tractoflow-version=\"${{ inputs.tractoflow-version }}\"" >> local-versioning.hcl - [ -z "${{ inputs.dmriqc-flow-version }}" ] || echo "dmriqc-flow-version=\"${{ inputs.dmriqc-flow-version }}\"" >> local-versioning.hcl - [ -z "${{ inputs.extractor-flow-version }}" ] || echo "extractor-flow-version=\"${{ inputs.extractor-flow-version }}\"" >> local-versioning.hcl - [ -z "${{ inputs.rbx-flow-version }}" ] || echo "rbx-flow-version=\"${{ inputs.rbx-flow-version }}\"" >> local-versioning.hcl - [ -z "${{ inputs.tractometry-flow-version }}" ] || echo "tractometry-flow-version=\"${{ inputs.tractometry-flow-version }}\"" >> local-versioning.hcl - [ -z "${{ inputs.register-flow-version }}" ] || echo "register-flow-version=\"${{ inputs.register-flow-version }}\"" >> local-versioning.hcl - [ -z "${{ inputs.disconets-flow-version }}" ] || echo "disconets-flow-version=\"${{ inputs.disconets-flow-version }}\"" >> local-versioning.hcl - [ -z "${{ inputs.freewater-flow-version }}" ] || echo "freewater-flow-version=\"${{ inputs.freewater-flow-version }}\"" >> local-versioning.hcl - [ -z "${{ inputs.noddi-flow-version }}" ] || echo "noddi-flow-version=\"${{ inputs.noddi-flow-version }}\"" >> local-versioning.hcl - [ -z "${{ inputs.bst-flow-version }}" ] || echo "bst-flow-version=\"${{ inputs.bst-flow-version }}\"" >> local-versioning.hcl - [ -z "${{ inputs.actions-runner-version }}" ] || echo "actions-runner-image=\"ghcr.io/actions/actions-runner:${{ inputs.actions-runner-version }}\"" >> local-versioning.hcl + + version "${{ inputs.scilpy-version }}" scilpy-version + version "${{ inputs.dmriqcpy-version }}" dmriqcpy-version + version "${{ inputs.nextflow-version }}" nextflow-version + version "${{ inputs.tractoflow-version }}" tractoflow-version + version "${{ inputs.dmriqc-flow-version }}" dmriqc-flow-version + version "${{ inputs.extractor-flow-version }}" extractor-flow-version + version "${{ inputs.rbx-flow-version }}" rbx-flow-version + version "${{ inputs.tractometry-flow-version }}" tractometry-flow-version + version "${{ inputs.register-flow-version }}" register-flow-version + version "${{ inputs.disconets-flow-version }}" disconets-flow-version + version "${{ inputs.freewater-flow-version }}" freewater-flow-version + version "${{ inputs.noddi-flow-version }}" noddi-flow-version + version "${{ inputs.bst-flow-version }}" bst-flow-version + version "${{ inputs.actions-runner-version }}" actions-runner-version + echo "DEPS_TAG=\"${{ inputs.scilus-dependencies-tag }}\"" >> local-versioning.hcl - [ "${{ inputs.target }}" == "scilus-flows" ] && echo "SCILUS_TAG=\"${{ inputs.scilus-for-scilus-flows-tag }}\"" >> local-versioning.hcl + if [ "${{ inputs.target }}" == "scilus-flows" ] + then + version "${{ inputs.scilus-for-scilus-flows-tag }}" SCILUS_TAG + fi + + vtk_version=$(cat versioning.hcl | grep vtk-version | cut -d "=" -f2) + vtk_version=$(echo $vtk_version | tr -d " " | tr -d "\"") + ACR_TAG=${{ inputs.actions-runner-version }}-vtk${vtk_version} + if [ -n "${{ inputs.actions-runner-version }}" ] + then + version "$ACR_TAG" ACR_TAG + fi + echo "bake-file=$PWD/local-versioning.hcl" >> $GITHUB_OUTPUT - name: Set output image tags and registry to publish to id: dockerhub-tags + env: + IMAGE: ${{ secrets.DOCKER_USERNAME }}/${{ inputs.target }} run: | touch tag-publishing - echo "${{ inputs.target }}.output=type=registry" >> tag-publishing - echo "${{ inputs.target }}.tags=${{ secrets.DOCKER_USERNAME }}/${{ inputs.target }}:${{ inputs.tag }}" >> tag-publishing - [ "${{ inputs.disable-builddate-tag }}" != "true" ] && echo "${{ inputs.target }}.tags=${{ secrets.DOCKER_USERNAME }}/${{ inputs.target }}:${{ inputs.tag }}-$(date +'%Y%m%d')" >> tag-publishing - [ "${{ inputs.update-latest }}" == "true" ] && echo "${{ inputs.target }}.tags=${{ secrets.DOCKER_USERNAME }}/${{ inputs.target }}:latest" >> tag-publishing + + [ -z ${{ inputs.tag }} ] || { + echo "${{ inputs.target }}.tags=${{ env.IMAGE }}:${{ inputs.tag }}" >> tag-publishing + } + + [ "${{ inputs.disable-builddate-tag }}" != "true" ] && { + echo "${{ inputs.target }}.tags=${{ env.IMAGE }}-$(date +'%Y%m%d')" >> tag-publishing + } + + if [ "${{ inputs.update-latest }}" == "true" ] + then + echo "${{ inputs.target }}.tags=${{ env.IMAGE }}:latest" >> tag-publishing + if [ "${{ inputs.target }}" == "actions-runner" ] + then + if [ -n "${{ inputs.actions-runner-version }}" ] + then + vtk_version=$(cat versioning.hcl | grep vtk-version | cut -d "=" -f2) + vtk_version=$(echo $vtk_version | tr -d " " | tr -d "\"") + ACR_TAG=${{ inputs.actions-runner-version }}-vtk${vtk_version} + echo "${{ inputs.target }}.tags=${{ env.IMAGE }}:$ACR_TAG" >> tag-publishing + fi + fi + fi + DELIM="$(echo $RANDOM | base64 | head -c 3; echo)" echo "tags-file=$PWD/tag-publishing" >> $GITHUB_OUTPUT echo "tags-string<<$DELIM" >> $GITHUB_OUTPUT @@ -192,7 +229,7 @@ jobs: echo "git-output=$GITHUB_OUTPUT" >> $GITHUB_OUTPUT - name: Upload versioning and caching hcl as artifacts - uses: actions/upload-artifact@v3.1.1 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: HCL artifacts path: | @@ -201,21 +238,17 @@ jobs: ${{ steps.dockerhub-tags.outputs.git-output }} - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - version: v0.11.0 - driver-opts: | - image=moby/buildkit:v0.11.6 + uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 - name: Build container id: container-build - uses: docker/bake-action@v3.1.0 + uses: docker/bake-action@76cc8060bdff6d632a465001e4cf300684c5472c # v5.7.0 with: targets: | ${{ inputs.target }} @@ -224,7 +257,8 @@ jobs: ./versioning.hcl ./docker-bake.hcl set: ${{ steps.dockerhub-tags.outputs.tags-string }} - push: true + pull: true + push: false - name: Save output container metadata to file id: container-metadata @@ -233,7 +267,7 @@ jobs: echo "metadata=$PWD/container-metadata.json" >> $GITHUB_OUTPUT - name: Upload bake definition - uses: actions/upload-artifact@v3.1.1 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: Baking artifacts path: | diff --git a/cache-push.hcl b/cache-push.hcl index b2c5c7d..d6d758e 100644 --- a/cache-push.hcl +++ b/cache-push.hcl @@ -6,46 +6,58 @@ variable "dockerhub-user-push" { default = "scilus" } +variable "cache-parameters" { + default = "mode=max,image-manifest=true,oci-mediatypes=true,compression=zstd,compression-level=9,force-compression=true" +} + +target "actions-runner" { + cache-to = ["type=registry,${cache-parameters},ref=${dockerhub-user-push}/build-cache:actions-runner"] +} + +target "actions-runner-vtk" { + cache-to = ["type=registry,${cache-parameters},ref=${dockerhub-user-push}/build-cache:actions-runner-vtk"] +} + target "scilus" { - cache-to = ["type=registry,mode=max,ref=${dockerhub-user-push}/build-cache:scilus"] + cache-to = ["type=registry,${cache-parameters},ref=${dockerhub-user-push}/build-cache:scilus"] } target "scilus-base" { - cache-to = ["type=registry,mode=max,ref=${dockerhub-user-push}/build-cache:scilus-base"] + cache-to = ["type=registry,${cache-parameters},ref=${dockerhub-user-push}/build-cache:scilus-base"] } target "scilpy-base" { - cache-to = ["type=registry,mode=max,ref=${dockerhub-user-push}/build-cache:scilpy"] + cache-to = ["type=registry,${cache-parameters},ref=${dockerhub-user-push}/build-cache:scilpy"] } target "dmriqcpy-base" { - cache-to = ["type=registry,mode=max,ref=${dockerhub-user-push}/build-cache:dmriqcpy"] + cache-to = ["type=registry,${cache-parameters},ref=${dockerhub-user-push}/build-cache:dmriqcpy"] } target "cmake" { - cache-to = ["type=registry,mode=max,ref=${dockerhub-user-push}/build-cache:cmake"] + cache-to = ["type=registry,${cache-parameters},ref=${dockerhub-user-push}/build-cache:cmake"] } target "vtk" { - cache-to = ["type=registry,mode=max,ref=${dockerhub-user-push}/build-cache:vtk"] + cache-to = ["type=registry,${cache-parameters},ref=${dockerhub-user-push}/build-cache:vtk"] } target "ants" { - cache-to = ["type=registry,mode=max,ref=${dockerhub-user-push}/build-cache:ants"] + cache-to = ["type=registry,${cache-parameters},ref=${dockerhub-user-push}/build-cache:ants"] } target "mrtrix" { - cache-to = ["type=registry,mode=max,ref=${dockerhub-user-push}/build-cache:mrtrix"] + cache-to = ["type=registry,${cache-parameters},ref=${dockerhub-user-push}/build-cache:mrtrix"] } target "fsl" { - cache-to = ["type=registry,mode=max,ref=${dockerhub-user-push}/build-cache:fsl"] + cache-to = ["type=registry,${cache-parameters},ref=${dockerhub-user-push}/build-cache:fsl"] } target "scilus-flows" { - cache-to = ["type=registry,mode=max,ref=${dockerhub-user-push}/build-cache:scilus-flows"] + cache-to = ["type=registry,${cache-parameters},ref=${dockerhub-user-push}/build-cache:scilus-flows"] } target "scilus-fsl" { - cache-to = ["type=registry,mode=max,ref=${dockerhub-user-push}/build-cache:scilus-deps"] + cache-to = ["type=registry,${cache-parameters},ref=${dockerhub-user-push}/build-cache:scilus-deps"] } diff --git a/containers/actions-runner.Dockerfile b/containers/actions-runner.Dockerfile index 592e46a..0af1b26 100644 --- a/containers/actions-runner.Dockerfile +++ b/containers/actions-runner.Dockerfile @@ -2,11 +2,15 @@ FROM actions-runner-base AS actions-runner ARG CONTAINER_INSTALL_USER ARG CONTAINER_RUN_USER +ARG RUNNER_VERSION +ARG RUNNER_HOOK_VERSION -ENV USER=${USER:-0} +ENV USER=0 ENV CONTAINER_INSTALL_USER=${CONTAINER_INSTALL_USER:-USER} ENV CONTAINER_RUN_USER=${CONTAINER_RUN_USER:-USER} ENV DEBIAN_FRONTEND=noninteractive +ENV RUNNER_VERSION=${RUNNER_VERSION:-2.319.1} +ENV RUNNER_HOOK_VERSION=${RUNNER_HOOK_VERSION:-0.6.1} USER $CONTAINER_INSTALL_USER @@ -27,4 +31,9 @@ ENV LANGUAGE="en_US.UTF-8" RUN locale-gen "en_US.UTF-8" && \ update-locale LANG=en_US.UTF-8 +WORKDIR / +RUN ( [ -f "VERSION" ] || touch VERSION ) && \ + echo "runner => ${RUNNER_VERSION}\n" >> VERSION && \ + echo "runner-hook => ${RUNNER_HOOK_VERSION}\n" >> VERSION + USER $CONTAINER_RUN_USER diff --git a/containers/ants.Dockerfile b/containers/ants.Dockerfile index 9a32d0b..5fa9a34 100644 --- a/containers/ants.Dockerfile +++ b/containers/ants.Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker.io/docker/dockerfile:1.6.0 +# syntax=docker.io/docker/dockerfile:1.10.0 FROM ants-builder as ants diff --git a/containers/cmake.Dockerfile b/containers/cmake.Dockerfile index 7b14199..ee7f1c9 100644 --- a/containers/cmake.Dockerfile +++ b/containers/cmake.Dockerfile @@ -1,4 +1,13 @@ -# syntax=docker.io/docker/dockerfile:1.6.0 +# syntax=docker.io/docker/dockerfile:1.10.0 + +FROM scratch as clone + +ARG CMAKE_REVISION + +ENV CMAKE_REVISION=${CMAKE_REVISION:-v3.16.3} + +ADD https://github.com/Kitware/CMake.git#${CMAKE_REVISION} /cmake + FROM cmake-builder AS cmake @@ -16,19 +25,14 @@ RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \ wget && \ rm -rf /var/lib/apt/lists/* -WORKDIR /tmp -ADD https://github.com/Kitware/CMake.git#${CMAKE_REVISION} /tmp/cmake - -WORKDIR /tmp/cmake -RUN ./bootstrap && \ +WORKDIR /cmake +RUN --mount=type=bind,rw,from=clone,source=/cmake,target=/cmake \ + ./bootstrap && \ [ -z "$CMAKE_BUILD_NTHREADS" ] && \ { make -j $(nproc --all); } || \ { make -j ${CMAKE_BUILD_NTHREADS}; } && \ make install -WORKDIR /tmp -RUN rm -rf cmake - WORKDIR / RUN ( [ -f "VERSION" ] || touch VERSION ) && \ echo "CMake => ${CMAKE_REVISION}\n" >> VERSION diff --git a/containers/dmriqcpy.context/dmriqcpy.Dockerfile b/containers/dmriqcpy.context/dmriqcpy.Dockerfile index d31a328..a67f4a1 100644 --- a/containers/dmriqcpy.context/dmriqcpy.Dockerfile +++ b/containers/dmriqcpy.context/dmriqcpy.Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker.io/docker/dockerfile:1.6.0 +# syntax=docker.io/docker/dockerfile:1.10.0 FROM dmriqcpy-base as dmriqcpy diff --git a/containers/fsl.context/fsl.Dockerfile b/containers/fsl.context/fsl.Dockerfile index 5428c50..b6ea375 100644 --- a/containers/fsl.context/fsl.Dockerfile +++ b/containers/fsl.context/fsl.Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker.io/docker/dockerfile:1.6.0 +# syntax=docker.io/docker/dockerfile:1.10.0 FROM fsl-builder as fsl diff --git a/containers/mrtrix.Dockerfile b/containers/mrtrix.Dockerfile index 40835f5..f0c31b8 100644 --- a/containers/mrtrix.Dockerfile +++ b/containers/mrtrix.Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker.io/docker/dockerfile:1.6.0 +# syntax=docker.io/docker/dockerfile:1.10.0 FROM mrtrix-builder as mrtrix diff --git a/containers/nextflow.Dockerfile b/containers/nextflow.Dockerfile index 276dcb6..9e21c12 100644 --- a/containers/nextflow.Dockerfile +++ b/containers/nextflow.Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker.io/docker/dockerfile:1.6.0 +# syntax=docker.io/docker/dockerfile:1.10.0 FROM nextflow-base as nextflow diff --git a/containers/scilpy.context/scilpy.Dockerfile b/containers/scilpy.context/scilpy.Dockerfile index 6881481..e72bea9 100644 --- a/containers/scilpy.context/scilpy.Dockerfile +++ b/containers/scilpy.context/scilpy.Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker.io/docker/dockerfile:1.6.0 +# syntax=docker.io/docker/dockerfile:1.10.0 FROM scilpy-base as scilpy diff --git a/containers/scilus-flows.Dockerfile b/containers/scilus-flows.Dockerfile index 7414ec3..1d655ae 100644 --- a/containers/scilus-flows.Dockerfile +++ b/containers/scilus-flows.Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker.io/docker/dockerfile:1.6.0 +# syntax=docker.io/docker/dockerfile:1.10.0 FROM flow-base as scilus-flows diff --git a/containers/scilus.context/scilus-base.Dockerfile b/containers/scilus.context/scilus-base.Dockerfile index 80534d7..95ea98c 100644 --- a/containers/scilus.context/scilus-base.Dockerfile +++ b/containers/scilus.context/scilus-base.Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker.io/docker/dockerfile:1.6.0 +# syntax=docker.io/docker/dockerfile:1.10.0 FROM scilus-image-base AS scilus-base diff --git a/containers/scilus.context/scilus.Dockerfile b/containers/scilus.context/scilus.Dockerfile index 369a29f..7736183 100644 --- a/containers/scilus.context/scilus.Dockerfile +++ b/containers/scilus.context/scilus.Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker.io/docker/dockerfile:1.6.0 +# syntax=docker.io/docker/dockerfile:1.10.0 FROM alpine as scilus-staging diff --git a/containers/vtk-omesa.context/vtk-omesa.Dockerfile b/containers/vtk-omesa.context/vtk-omesa.Dockerfile index 53ff07a..1482229 100644 --- a/containers/vtk-omesa.context/vtk-omesa.Dockerfile +++ b/containers/vtk-omesa.context/vtk-omesa.Dockerfile @@ -1,6 +1,18 @@ -# syntax=docker.io/docker/dockerfile:1.6.0 +# syntax=docker.io/docker/dockerfile:1.10.0 -FROM vtk-builder as vtk +FROM scratch AS src + +ARG MESA_VERSION +ARG VTK_VERSION + +ENV MESA_VERSION=${MESA_VERSION:-19.0.8} +ENV VTK_VERSION=${VTK_VERSION:-8.2.0} + +ADD --link https://archive.mesa3d.org/mesa-${MESA_VERSION}.tar.xz /mesa/mesa.tar.xz +ADD --link https://gitlab.kitware.com/vtk/vtk/-/archive/v${VTK_VERSION}/vtk-v${VTK_VERSION}.tar.gz /vtk/vtk.tar.gz +ADD --chmod=644 --link patches/vtk-${VTK_VERSION}/ /vtk_patches/ + +FROM vtk-builder AS vtk ARG MESA_BUILD_NTHREADS ARG MESA_INSTALL_PATH @@ -22,9 +34,8 @@ ENV VTK_INSTALL_PATH=${VTK_INSTALL_PATH:-/vtk} ENV VTK_PYTHON_VERSION=${VTK_PYTHON_VERSION:-3.10} ENV VTK_VERSION=${VTK_VERSION:-8.2.0} ENV VTK_WHEEL_VERSION_LOCAL=${VTK_WHEEL_VERSION_LOCAL:-scilosmesa} -env WHEELHOUSE_PATH=${WHEELHOUSE_PATH:-/wheelhouse} +ENV WHEELHOUSE_PATH=${WHEELHOUSE_PATH:-/wheelhouse} -WORKDIR / RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \ if [ "${VTK_PYTHON_VERSION%%.*}" = "3" ]; then export PYTHON_MAJOR=3; fi && \ mkdir ${MESA_INSTALL_PATH} ${VTK_INSTALL_PATH} ${VTK_BUILD_PATH} ${WHEELHOUSE_PATH} && \ @@ -52,13 +63,12 @@ RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \ xorg-dev && \ rm -rf /var/lib/apt/lists/* -WORKDIR / -ADD https://archive.mesa3d.org/mesa-${MESA_VERSION}.tar.xz mesa.tar.xz -RUN tar -xJf mesa.tar.xz && \ - rm mesa.tar.xz - -WORKDIR /mesa-${MESA_VERSION} -RUN mkdir build && \ +WORKDIR /mesa_source +RUN --mount=type=bind,rw,from=src,source=/mesa,target=/mesa_source \ + tar -xJf mesa.tar.xz && \ + rm mesa.tar.xz && \ + cd mesa-${MESA_VERSION} && \ + mkdir build && \ echo "[binaries]\nllvm-config = '/usr/bin/llvm-config'" >> llvm.ini && \ meson setup \ --native-file llvm.ini \ @@ -90,16 +100,13 @@ RUN mkdir build && \ ENV LD_LIBRARY_PATH=${MESA_INSTALL_PATH}/lib/x86_64-linux-gnu:${MESA_INSTALL_PATH}/lib:$LD_LIBRARY_PATH WORKDIR ${VTK_BUILD_PATH} -ADD https://gitlab.kitware.com/vtk/vtk/-/archive/v${VTK_VERSION}/vtk-v${VTK_VERSION}.tar.gz vtk.tar.gz -RUN tar -xzf vtk.tar.gz && \ - rm vtk.tar.gz - -WORKDIR ${VTK_BUILD_PATH}/vtk-v${VTK_VERSION} -ADD patches/vtk-${VTK_VERSION}/setup.py.in CMake/setup.py.in -ADD patches/vtk-${VTK_VERSION}/vtkWheelPreparation.cmake CMake/vtkWheelPreparation.cmake - -WORKDIR ${VTK_BUILD_PATH} -RUN if [ "${VTK_PYTHON_VERSION%%.*}" = "3" ]; then export PYTHON_MAJOR=3; fi && \ +RUN --mount=type=bind,rw,from=src,source=/vtk,target=${VTK_BUILD_PATH} \ + --mount=type=bind,rw,from=src,source=/vtk_patches,target=/vtk_patches \ + tar -xzf vtk.tar.gz && \ + rm vtk.tar.gz && \ + cp /vtk_patches/vtkWheelPreparation.cmake vtk-v${VTK_VERSION}/CMake/. && \ + cp /vtk_patches/setup.py.in vtk-v${VTK_VERSION}/CMake/. && \ + if [ "${VTK_PYTHON_VERSION%%.*}" = "3" ]; then export PYTHON_MAJOR=3; fi && \ cmake -GNinja \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS:BOOL=ON \ @@ -147,9 +154,7 @@ RUN if [ "${VTK_PYTHON_VERSION%%.*}" = "3" ]; then export PYTHON_MAJOR=3; fi && [ -z "$VTK_BUILD_NTHREADS" ] && \ { ninja -j $(nproc --all); } || \ { ninja -j ${VTK_BUILD_NTHREADS}; } && \ - ninja install - -RUN if [ "${VTK_PYTHON_VERSION%%.*}" = "3" ]; then export PYTHON_MAJOR=3; fi && \ + ninja install && \ python${PYTHON_MAJOR} setup.py bdist_wheel && \ cp dist/vtk-${VTK_VERSION}+${VTK_WHEEL_VERSION_LOCAL}-cp310-cp310-linux_x86_64.whl ${WHEELHOUSE_PATH}/. @@ -158,6 +163,7 @@ ENV VTKPYTHONPATH=${VTK_DIR}/lib/python${VTK_PYTHON_VERSION}/site-packages:${VTK ENV LD_LIBRARY_PATH=${VTK_DIR}/lib:$LD_LIBRARY_PATH ENV PYTHONPATH=${PYTHONPATH}:${VTKPYTHONPATH} + FROM vtk-base as vtk-install ARG CONTAINER_INSTALL_USER @@ -180,7 +186,7 @@ ENV PYTHONNOUSERSITE=true ENV VTK_DIR=${VTK_INSTALL_PATH}/build ENV VTKPYTHONPATH=${VTK_DIR}/vtkmodules -ENV LD_LIBRARY_PATH=${VTK_DIR}/lib.linux-x86_64-${VTK_PYTHON_VERSION}/vtkmodules:${MESA_INSTALL_PATH}/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH +ENV LD_LIBRARY_PATH=${VTK_DIR}/lib.linux-x86_64-${VTK_PYTHON_VERSION}/vtkmodules:${MESA_INSTALL_PATH}/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH ENV PYTHONPATH=${PYTHONPATH}:${VTKPYTHONPATH} USER ${CONTAINER_INSTALL_USER:-0} diff --git a/docker-bake.hcl b/docker-bake.hcl index 2408503..9f33399 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -12,8 +12,8 @@ variable "base-build-image" { default = "ubuntu:22.04" } -variable "actions-runner-image" { - default = "ghcr.io/actions/actions-runner:2.312.0" +variable "actions-runner-version" { + default = "2.319.1" } variable "ants-revision" { @@ -230,6 +230,7 @@ target "actions-runner" { actions-runner-base = "target:actions-runner-vtk" } args = { + RUNNER_VERSION = "${actions-runner-version}" CONTAINER_INSTALL_USER = "root" CONTAINER_RUN_USER = "runner" } @@ -244,7 +245,7 @@ target "actions-runner" { target "actions-runner-vtk" { inherits = ["vtk"] contexts = { - vtk-base = "docker-image://${actions-runner-image}" + vtk-base = "docker-image://ghcr.io/actions/actions-runner:${actions-runner-version}" } args = { CONTAINER_INSTALL_USER = "root" diff --git a/versioning.hcl b/versioning.hcl index da7dfb3..0662cd9 100644 --- a/versioning.hcl +++ b/versioning.hcl @@ -2,13 +2,14 @@ base-install-image="nvidia/cuda:11.7.1-runtime-ubuntu22.04" base-build-image="ubuntu:jammy-20230301" -actions-runner-image="ghcr.io/actions/actions-runner:2.319.1" + +actions-runner-version="2.319.1" dmriqcpy-revision="0.1.7" scilpy-revision="2.0.2" ants-revision="2.4.3" -cmake-revision="3.16.3" +cmake-revision="v3.21.6" fsl-version="6.0.6.4" fsl-installer-version="3.14.0" mrtrix-revision="3.0.4"