Skip to content

Commit

Permalink
update installer scripts, add build action
Browse files Browse the repository at this point in the history
  • Loading branch information
espenhgn committed May 6, 2024
1 parent 0273554 commit c4c9674
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 25 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/container_build_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: container-build-push

on:
push:
branches:
- 'main'
- 'espenhgn/issue20'
tags:
- "v*.*.*"

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository_owner }}/mixer
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:"
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file:
./Dockerfile
platforms: linux/amd64

build-apptainer-container:
needs: docker
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
name: Build Apptainer Container
steps:
- name: Check out code for the container builds
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/mixer
tags: |
type=semver,pattern={{version}}
type=ref,event=branch
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Apptainer container
run: |
tags="${{ steps.meta.outputs.tags }}"
csv_tags=$(printf "%s\n" "$tags" | awk -F: 'NR==1{printf "%s,", $0; next} {printf "%s,", $NF}' | sed 's/,$//')
IFS= read -r first_tag <<EOF
$tags
EOF
echo "The first tag is: $first_tag"
echo "CSV-tags are: $csv_tags"
echo ${{ secrets.GITHUB_TOKEN }} | oras login --username ${{ github.repository_owner }} --password-stdin ghcr.io
docker pull kaczmarj/apptainer:latest
docker run --rm --privileged -v $(pwd):/work kaczmarj/apptainer build mixer.sif docker://"$first_tag"
oras push "$csv_tags" --artifact-type application/vnd.acme.rocket.config mixer.sif
rm mixer.sif
shell: sh
16 changes: 6 additions & 10 deletions src/dockerfiles/mixer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,22 @@ RUN chmod +x apt_get_essential.sh && \
bash apt_get_essential.sh

WORKDIR /tmp
COPY /scripts/install_miniconda3.sh .
RUN chmod +x install_miniconda3.sh && \
bash install_miniconda3.sh

RUN conda install conda=23.9.0 && \
conda config --add channels conda-forge && \
conda config --set channel_priority strict && \
conda install \
COPY /scripts/install_mambaforge.sh .
RUN chmod +x install_mambaforge.sh && \
bash install_mambaforge.sh

RUN mamba install python=3.8.18 \
jupyterlab=4.0.7 \
matplotlib=3.7.3 \
matplotlib-venn=0.11.9 \
numpy=1.24.4 \
numdifftools=0.9.41 \
pandas=2.0.3 \
python=3.8 \
scipy=1.10.1 \
seaborn=0.13.0 \
statsmodels=0.14.0 \
--yes && \
conda clean -a -y
mamba clean -a -y

WORKDIR /tools/plink
COPY /scripts/install_plink.sh /tmp
Expand Down
12 changes: 6 additions & 6 deletions src/scripts/apt_get_essential.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ apt-get install -y --no-install-recommends \
build-essential=12.8ubuntu1.1 \
bzip2=1.0.8-2 \
cmake=3.16.3-1ubuntu1.20.04.1 \
curl=7.68.0-1ubuntu2.21 \
curl=7.68.0-1ubuntu2.22 \
dos2unix=7.4.0-2 \
gdb=9.2-0ubuntu1~20.04.1 \
gfortran=4:9.3.0-1ubuntu2 \
git=1:2.25.1-1ubuntu3.11 \
less=551-1ubuntu0.1 \
less=551-1ubuntu0.3 \
libatlas-base-dev=3.10.3-8ubuntu7 \
libcurl4=7.68.0-1ubuntu2.21 \
libcurl4-openssl-dev=7.68.0-1ubuntu2.21 \
libcurl4=7.68.0-1ubuntu2.22 \
libcurl4-openssl-dev=7.68.0-1ubuntu2.22 \
libgomp1=10.5.0-1ubuntu1~20.04 \
libgsl-dev=2.5+dfsg-6+deb10u1build0.20.04.1 \
libnss3=2:3.49.1-1ubuntu1.9 \
libnss3=2:3.98-0ubuntu0.20.04.2 \
libpcre2-dev=10.34-7ubuntu0.1 \
libquadmath0=10.5.0-1ubuntu1~20.04 \
libxt-dev=1:1.1.5-1 \
Expand All @@ -36,7 +36,7 @@ apt-get install -y --no-install-recommends \
tar=1.30+dfsg-7ubuntu0.20.04.3 \
tofrodos=1.7.13+ds-4 \
unzip=6.0-25ubuntu1.1 \
vim=2:8.1.2269-1ubuntu5.20 \
vim=2:8.1.2269-1ubuntu5.22 \
wget=1.20.3-1ubuntu2 \
zlib1g-dev=1:1.2.11.dfsg-2ubuntu1.5

Expand Down
9 changes: 9 additions & 0 deletions src/scripts/install_mambaforge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
set -euo pipefail

curl -sSL https://github.com/conda-forge/miniforge/releases/download/24.3.0-0/Mambaforge-24.3.0-0-$(uname)-$(uname -m).sh -o /tmp/mambaforge.sh \
&& mkdir /root/.conda \
&& bash /tmp/mambaforge.sh -bfp /usr/local \
&& rm -rf /tmp/mambaforge.sh

export PATH=$PATH:/opt/conda/bin
9 changes: 0 additions & 9 deletions src/scripts/install_miniconda3.sh

This file was deleted.

0 comments on commit c4c9674

Please sign in to comment.