Skip to content
Merged

Dev #153

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
52 changes: 27 additions & 25 deletions .github/workflows/build_deploy_container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Export Secrets to Environment
run: |
echo "SINGULARITY_LIBRARY_TOKEN=${{ secrets.SINGULARITY_LIBRARY_TOKEN }}" >> $GITHUB_ENV
Expand All @@ -53,30 +53,29 @@ jobs:
run: |
docker buildx build --platform linux/amd64 -f $DOCKERFILE_PATH -t $DOCKER_IMAGE_NAME:latest -t $DOCKER_IMAGE_NAME:${{ steps.set_tag.outputs.tag }} --push .

- name: Clean up Docker build artifacts
run: |
docker system prune -af

- name: Maximize build disk space
uses: easimon/maximize-build-space@v10
with:
root-reserve-mb: 512
swap-size-mb: 1024
remove-dotnet: 'true'

- name: Setup Apptainer
uses: eWaterCycle/setup-apptainer@v2.0.0

- name: Configure Singularity temp directories
run: |
# create a temp area inside the GitHub runner's large temp folder
mkdir -p $RUNNER_TEMP/singularity
echo "APPTAINER_TMPDIR=$RUNNER_TEMP/singularity" >> $GITHUB_ENV
# optional: keep a separate cache dir
mkdir -p $RUNNER_TEMP/singularity/cache
echo "APPTAINER_CACHEDIR=$RUNNER_TEMP/singularity/cache" >> $GITHUB_ENV

- name: Check free space
run: |
df -h

mkdir -p "$GITHUB_WORKSPACE/.singularity/cache"
echo "APPTAINER_TMPDIR=$GITHUB_WORKSPACE/.singularity" >> $GITHUB_ENV
echo "APPTAINER_CACHEDIR=$GITHUB_WORKSPACE/.singularity/cache" >> $GITHUB_ENV

- name: Convert Docker Image to Singularity SIF
run: |
apptainer pull --disable-cache --tmpdir $RUNNER_TEMP/singularity /mnt/genopred_image.sif docker://${DOCKER_IMAGE_NAME}:latest

apptainer pull --disable-cache \
--tmpdir "$GITHUB_WORKSPACE/.singularity" \
"$GITHUB_WORKSPACE/genopred_image.sif" \
docker://${DOCKER_IMAGE_NAME}:latest

- name: Install expect
run: |
sudo apt-get update
Expand All @@ -98,14 +97,17 @@ jobs:
send -- "${{ secrets.SIGNING_KEY_PASSWORD }}\r"
expect eof
'

- name: Sign the Singularity Image
run: |
expect -c '
spawn apptainer sign /mnt/genopred_image.sif
expect "Enter your key passphrase : "
send -- "${{ secrets.SIGNING_KEY_PASSWORD }}\r"
expect eof
'
SIF_PATH="$GITHUB_WORKSPACE/genopred_image.sif"
expect -c "
spawn apptainer sign \"$SIF_PATH\"
expect \"Enter your key passphrase : \"
send -- \"${{ secrets.SIGNING_KEY_PASSWORD }}\r\"
expect eof
"

- name: Create Token File
run: echo "${{ secrets.SINGULARITY_LIBRARY_TOKEN }}" > tokenfile

Expand All @@ -117,7 +119,7 @@ jobs:

- name: Push Singularity Image to Singularity Library
run: |
apptainer push /mnt/genopred_image.sif $SINGULARITY_IMAGE_NAME:latest
apptainer push "$GITHUB_WORKSPACE/genopred_image.sif" "$SINGULARITY_IMAGE_NAME:latest"

- name: Setup tmate session
if: ${{ failure() }}
Expand Down
22 changes: 11 additions & 11 deletions pipeline/misc/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ RUN apt-get update && \
echo 'exec /bin/tar --no-same-owner "$@"' >> /usr/local/bin/tar && \
chmod +x /usr/local/bin/tar

# Install Mambaforge
RUN wget https://github.com/conda-forge/miniforge/releases/download/4.10.3-10/Mambaforge-4.10.3-10-Linux-x86_64.sh && \
bash Mambaforge-4.10.3-10-Linux-x86_64.sh -b -p /opt/mambaforge && \
rm Mambaforge-4.10.3-10-Linux-x86_64.sh
# Install Miniforge
RUN wget https://github.com/conda-forge/miniforge/releases/download/24.11.3-0/Miniforge3-24.11.3-0-Linux-x86_64.sh && \
bash Miniforge3-24.11.3-0-Linux-x86_64.sh -b -p /opt/miniforge && \
rm Miniforge3-24.11.3-0-Linux-x86_64.sh

# Download GenoPred
RUN mkdir -p /tools/GenoPred && \
Expand All @@ -22,20 +22,20 @@ RUN mkdir -p /tools/GenoPred && \
git fetch --tags

# Create genopred env
RUN /opt/mambaforge/bin/conda init bash && \
echo "source /opt/mambaforge/etc/profile.d/conda.sh" >> /etc/bash.bashrc && \
. /opt/mambaforge/etc/profile.d/conda.sh && \
RUN /opt/miniforge/bin/conda init bash && \
echo "source /opt/miniforge/etc/profile.d/conda.sh" >> /etc/bash.bashrc && \
. /opt/miniforge/etc/profile.d/conda.sh && \
mamba env update -n genopred -f /tools/GenoPred/pipeline/envs/pipeline.yaml && \
mamba clean -a -y

# Run initial snakemake command to setup dependencies
RUN /opt/mambaforge/bin/conda init bash && \
echo "source /opt/mambaforge/etc/profile.d/conda.sh" >> /etc/bash.bashrc && \
. /opt/mambaforge/etc/profile.d/conda.sh && \
RUN /opt/miniforge/bin/conda init bash && \
echo "source /opt/miniforge/etc/profile.d/conda.sh" >> /etc/bash.bashrc && \
. /opt/miniforge/etc/profile.d/conda.sh && \
conda activate genopred && \
cd /tools/GenoPred/pipeline && \
snakemake --restart-times 3 -j1 --use-conda --conda-frontend mamba install_r_packages resources/software/pgscatalog_utils/download_pgscatalog_utils.done && \
mamba clean -a -y

ENTRYPOINT ["/bin/bash"]
CMD ["-c", "source /opt/mambaforge/etc/profile.d/conda.sh && conda init && source ~/.bashrc && conda activate genopred && cd /tools/GenoPred/pipeline && exec /bin/bash"]
CMD ["-c", "source /opt/miniforge/etc/profile.d/conda.sh && conda init && source ~/.bashrc && conda activate genopred && cd /tools/GenoPred/pipeline && exec /bin/bash"]