Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions .github/workflows/build-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
exit 1

build-n-test:
runs-on: [gpu]
runs-on: [ubuntu-latest]

strategy:
matrix:
Expand Down Expand Up @@ -70,12 +70,3 @@ jobs:
run: |
rm -rf /home/runner/.buildx-cache
mv /home/runner/.buildx-cache-new /home/runner/.buildx-cache

- name: Run tests
if: ${{ matrix.target == 'develop' }}
run: |
docker run --rm --gpus 'device=1' ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} tests/test_opticks.sh
docker run --rm --gpus 'device=1' ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} tests/test_simg4ox.sh
docker run --rm --gpus 'device=1' ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} tests/test_GPURaytrace.sh
docker run --rm --gpus 'device=1' ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} tests/test_GPUPhotonFileSource.sh
docker run --rm --gpus 'device=1' ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} tests/test_GPUPhotonSource_8x8SiPM.sh
34 changes: 30 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ FROM nvidia/cuda:${CUDA_VERSION}-devel-${OS} AS base
ARG OPTIX_VERSION=9.0.0
ARG GEANT4_VERSION=11.3.2
ARG CMAKE_VERSION=4.2.1
ARG CMAKE_BUILD_JOBS=4
ARG GEANT4_INSTALL_DATA=ON
ARG GEANT4_DATA_URL=https://geant4-data.web.cern.ch/datasets
ARG GEANT4_DATASETS="\
G4NDL.4.7.1.tar.gz \
G4EMLOW.8.6.1.tar.gz \
G4PhotonEvaporation.6.1.tar.gz \
G4RadioactiveDecay.6.1.2.tar.gz \
G4PARTICLEXS.4.1.tar.gz \
G4PII.1.3.tar.gz \
G4RealSurface.2.2.tar.gz \
G4SAIDDATA.2.0.tar.gz \
G4ABLA.3.3.tar.gz \
G4INCL.1.2.tar.gz \
G4ENSDFSTATE.3.0.tar.gz \
G4CHANNELING.1.0.tar.gz \
G4TENDL.1.4.tar.gz \
G4NUDEXLIB.1.0.tar.gz \
G4URRPT.1.1.tar.gz"
Comment on lines +14 to +29
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GEANT4_DATASETS is pinned to specific dataset versions while GEANT4_VERSION remains configurable. If someone overrides GEANT4_VERSION at build time, this list can become inconsistent with the chosen Geant4 release. Consider either tying the dataset list to GEANT4_VERSION (version-specific defaults) or documenting that overriding GEANT4_VERSION requires also overriding GEANT4_DATASETS.

Copilot uses AI. Check for mistakes.

ENV DEBIAN_FRONTEND=noninteractive

Expand All @@ -28,10 +47,17 @@ RUN curl -fsSL https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSI
| tar -xz --strip-components=1 -C /usr/local

RUN mkdir -p /opt/geant4/src && curl -sL https://github.com/Geant4/geant4/archive/refs/tags/v${GEANT4_VERSION}.tar.gz | tar -xz --strip-components 1 -C /opt/geant4/src \
&& cmake -S /opt/geant4/src -B /opt/geant4/build -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_QT=ON -DGEANT4_USE_QT_QT6=ON -DGEANT4_USE_GDML=ON -DGEANT4_INSTALL_DATA=ON -DGEANT4_BUILD_MULTITHREADED=ON \
&& cmake --build /opt/geant4/build --parallel --target install \
&& cmake -S /opt/geant4/src -B /opt/geant4/build -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_QT=ON -DGEANT4_USE_QT_QT6=ON -DGEANT4_USE_GDML=ON -DGEANT4_INSTALL_DATA=OFF -DGEANT4_INSTALL_DATADIR=share/Geant4/data -DGEANT4_BUILD_MULTITHREADED=ON \
&& cmake --build /opt/geant4/build --parallel ${CMAKE_BUILD_JOBS} --target install \
&& rm -fr /opt/geant4

RUN if [ "${GEANT4_INSTALL_DATA}" = "ON" ]; then \
mkdir -p /usr/local/share/Geant4/data; \
for dataset in ${GEANT4_DATASETS}; do \
curl -fsSL "${GEANT4_DATA_URL}/${dataset}" | tar -xz -C /usr/local/share/Geant4/data; \
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dataset download/extract loop uses curl | tar without any integrity verification (hash/signature) for the tarballs. If a download is corrupted or the endpoint is compromised, this can silently introduce a supply-chain risk during image builds. Prefer downloading to a file and verifying an expected SHA256 (Geant4 publishes checksums), then extracting with safer tar flags (e.g., avoid preserving ownership/permissions) before deleting the archive.

Suggested change
curl -fsSL "${GEANT4_DATA_URL}/${dataset}" | tar -xz -C /usr/local/share/Geant4/data; \
dataset_url="${GEANT4_DATA_URL}/${dataset}"; \
tmp_archive="/tmp/${dataset}"; \
curl -fsSL "${dataset_url}" -o "${tmp_archive}"; \
checksum_var_name="GEANT4_SHA256_$(echo "${dataset}" | tr '.-' '_' | tr '[:lower:]' '[:upper:]')"; \
expected_checksum=$(eval "printf '%s' \"\${${checksum_var_name}:-}\""); \
if [ -n "${expected_checksum}" ]; then \
echo "${expected_checksum} ${tmp_archive}" | sha256sum -c -; \
fi; \
tar -xzf "${tmp_archive}" --no-same-owner --no-same-permissions -C /usr/local/share/Geant4/data; \
rm -f "${tmp_archive}"; \

Copilot uses AI. Check for mistakes.
done; \
fi

RUN mkdir -p /opt/clhep/src && curl -sL https://gitlab.cern.ch/CLHEP/CLHEP/-/archive/CLHEP_2_4_7_1/CLHEP-CLHEP_2_4_7_1.tar.gz | tar -xz --strip-components 1 -C /opt/clhep/src \
&& cmake -S /opt/clhep/src -B /opt/clhep/build \
&& cmake --build /opt/clhep/build --parallel --target install \
Expand Down Expand Up @@ -84,7 +110,7 @@ FROM base AS release
COPY . $OPTICKS_HOME

RUN cmake -S $OPTICKS_HOME -B $OPTICKS_BUILD -DCMAKE_INSTALL_PREFIX=$OPTICKS_PREFIX -DCMAKE_BUILD_TYPE=Release \
&& cmake --build $OPTICKS_BUILD --parallel --target install
&& cmake --build $OPTICKS_BUILD --parallel ${CMAKE_BUILD_JOBS} --target install


FROM base AS develop
Expand All @@ -94,4 +120,4 @@ RUN apt update && apt install -y x11-apps mesa-utils vim
COPY . $OPTICKS_HOME

RUN cmake -S $OPTICKS_HOME -B $OPTICKS_BUILD -DCMAKE_INSTALL_PREFIX=$OPTICKS_PREFIX -DCMAKE_BUILD_TYPE=Debug \
&& cmake --build $OPTICKS_BUILD --parallel --target install
&& cmake --build $OPTICKS_BUILD --parallel ${CMAKE_BUILD_JOBS} --target install
Loading