From df9fdc1f0092fd89af5678ed85a6dca48d7d705e Mon Sep 17 00:00:00 2001 From: YanzhaoW Date: Sun, 5 Jan 2025 20:36:03 +0100 Subject: [PATCH] test docker auto build --- .github/workflows/container_deploy.yml | 42 ++++++++++++++++++++++++++ util/container/Dockerfile | 28 +++++++++++++++++ util/container/neuland.def | 8 +++++ util/container/test.def | 6 ++++ 4 files changed, 84 insertions(+) create mode 100644 .github/workflows/container_deploy.yml create mode 100644 util/container/Dockerfile create mode 100644 util/container/neuland.def create mode 100644 util/container/test.def diff --git a/.github/workflows/container_deploy.yml b/.github/workflows/container_deploy.yml new file mode 100644 index 000000000..5a704f883 --- /dev/null +++ b/.github/workflows/container_deploy.yml @@ -0,0 +1,42 @@ +name: deploy-container + +on: + push: + branches: [ neuland_new_calibration ] + workflow_dispatch: + + +jobs: + setup: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: 'true' + + # - name: Login to Docker Hub + # uses: docker/login-action@v3 + # with: + # username: ${{ vars.DOCKER_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} + + # - name: Build and push + # uses: docker/build-push-action@v6 + # with: + # push: true + # context: util/container + # tags: ${{ vars.DOCKER_USERNAME }}/r3bdev:test + + - name: build apptainer + run: | + sudo add-apt-repository -y ppa:apptainer/ppa + sudo apt-get update + sudo apt-get install -y apptainer + # sudo apptainer build --notest test.sif ./util/container/test.def + apptainer remote add --no-login SylabsCloud cloud.sycloud.io + apptainer remote login -p ${{ secrets.SYLABS_TOKEN }} SylabsCloud + apptainer remote list + apptainer remote status + apptainer push -D "For testing" -U test.sif library://${{ vars.SYLABS_USERNAME }}/r3bdev/r3broot:test diff --git a/util/container/Dockerfile b/util/container/Dockerfile new file mode 100644 index 000000000..b7bafa294 --- /dev/null +++ b/util/container/Dockerfile @@ -0,0 +1,28 @@ +FROM yanzhaowang/r3bdev:fedora41 + +ENV FAIRROOTPATH="/root/FairRoot" +ENV UCESB_DIR="/root/ucesb" +ENV PEDEDIR="/root" +ENV THREAD_NUM=4 +ENV R3B_BRNAME="neuland_new_calibration" + +RUN yes | dnf upgrade --refresh + +# RUN yes | dnf upgrade --refresh &&\ +# dnf install -y byacc && pip install conan --upgrade &&\ +# mkdir -p $FAIRROOTPATH &&\ +# cd /tmp &&\ +# git clone --depth 1 --branch dev https://github.com/FairRootGroup/FairRoot.git &&\ +# cd FairRoot &&\ +# mkdir build && cd build && cmake -GNinja -DCMAKE_INSTALL_PREFIX=${FAIRROOTPATH} .. &&\ +# ninja -j${THREAD_NUM} && ninja install &&\ +# cd /root && git clone https://git.chalmers.se/expsubphys/ucesb.git && cd ucesb && make empty/empty &&\ +# cd /root &&\ +# git clone --depth 1 --branch ${R3B_BRNAME} https://github.com/YanzhaoW/R3BRoot.git &&\ +# cd R3BRoot && git submodule update --init && cmake --preset default -GNinja &&\ +# cmake --build --preset default -- -j${THREAD_NUM} &&\ +# source build/config.sh && root -l -q neuland/geobase/create_neuland_geo.C &&\ +# rm -rf /tmp/FairRoot + +# ENV CONFIG_FILE="/root/R3BRoot/build/config.sh" +# ENTRYPOINT ["/bin/bash", "--rcfile", "/root/R3BRoot/build/config.sh"] diff --git a/util/container/neuland.def b/util/container/neuland.def new file mode 100644 index 000000000..d4e650d33 --- /dev/null +++ b/util/container/neuland.def @@ -0,0 +1,8 @@ +BootStrap: docker +From: yanzhaowang/r3bdev:r3broot + +%environment + source /root/R3BRoot/build/config.sh + +%runscript + neulandSim $@ diff --git a/util/container/test.def b/util/container/test.def new file mode 100644 index 000000000..722063840 --- /dev/null +++ b/util/container/test.def @@ -0,0 +1,6 @@ +BootStrap: docker +From: yanzhaowang/r3bdev:test + +%runscript + echo "$@" +