Skip to content

Commit 43817d1

Browse files
committed
Add Dockerfile
1 parent d0888cb commit 43817d1

File tree

3 files changed

+234
-0
lines changed

3 files changed

+234
-0
lines changed

.dockerignore

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
### Linux ###
2+
*~
3+
4+
# temporary files which can be created if a process still has a handle open of a deleted file
5+
.fuse_hidden*
6+
7+
# KDE directory preferences
8+
.directory
9+
10+
# Linux trash folder which might appear on any partition or disk
11+
.Trash-*
12+
13+
# .nfs files are created when an open file is removed but is still being accessed
14+
.nfs*
15+
16+
### macOS ###
17+
*.DS_Store
18+
.AppleDouble
19+
.LSOverride
20+
21+
# Thumbnails
22+
._*
23+
24+
### Windows ###
25+
# Windows thumbnail cache files
26+
Thumbs.db
27+
ehthumbs.db
28+
ehthumbs_vista.db
29+
30+
# Folder config file
31+
Desktop.ini
32+
33+
# Recycle Bin used on file shares
34+
$RECYCLE.BIN/
35+
36+
# Windows shortcuts
37+
*.lnk
38+
39+
40+
### Ignore temporary editor files ###
41+
*.m~
42+
*.asv
43+
*._*
44+
*.*~
45+
46+
### Ignore binaries ###
47+
*.mexmaci64
48+
*.mexa64
49+
*.mexw64
50+
*.mexw32
51+
*.dll
52+
*.dylib
53+
*.so
54+
55+
### Ignore generated documentation and LaTeX aux files ###
56+
doc/doxy/html
57+
doc/tex/*.aux
58+
doc/tex/*.fdb_latexmk
59+
doc/tex/*.bbl
60+
doc/tex/*.bcf
61+
doc/tex/*.run.xml
62+
doc/tex/*.out
63+
doc/tex/*.blg
64+
doc/tex/*.lot
65+
doc/tex/*.lof
66+
doc/tex/*.toc
67+
doc/tex/*.log
68+
doc/tex/*.idx
69+
doc/tex/*.ind
70+
doc/tex/*.gitinfo
71+
doc/tex/*.synctex.gz
72+
doc/tex/*.pdf
73+
doc/tex/docs/*.aux
74+
75+
### Ignore IDE files ###
76+
.vs/
77+
.vscode/
78+
.idea/
79+
*.iws
80+
*.kdev4
81+
.kdev4/
82+
compile_commands.json
83+
84+
# Ignore build and install directories
85+
build
86+
build_*
87+
install
88+
vcpkg_installed
89+
90+
# Ignore Dockerfile itself, so changes to the Dockerfile don't re-run the entire workflow
91+
Dockerfile

.github/workflows/cd_docker.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: build_docker_containers
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+' # Matches v1.2.3
7+
- 'v[0-9]+.[0-9]+.[0-9]+-*' # Matches v1.2.3-alpha, v1.2.3-beta.1, etc.
8+
branches:
9+
- feature/add_docker_build
10+
workflow_dispatch:
11+
inputs:
12+
ref:
13+
description: 'Commit hash, branch name, or tag to run the CI pipeline for'
14+
required: false
15+
default: 'master'
16+
type: string
17+
cadet_python_hash:
18+
description: 'CADET-Python git hash or branch'
19+
required: false
20+
default: 'master'
21+
type: string
22+
cadet_process_hash:
23+
description: 'CADET-Process git hash or branch'
24+
required: false
25+
default: 'master'
26+
type: string
27+
28+
29+
jobs:
30+
docker:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Get versions for Python and Process
34+
run: |
35+
git clone https://github.com/cadet/CADET-Python tmp-python
36+
git -C tmp-python checkout ${{ github.event.inputs.cadet_python_hash || 'master' }}
37+
PYTHON_VERSION=$(grep -Po '(?<=__version__ = ")[^"]+' tmp-python/cadet/__init__.py || echo "dev")
38+
39+
git clone https://github.com/fau-advanced-separations/CADET-Process tmp-process
40+
git -C tmp-process checkout ${{ github.event.inputs.cadet_process_hash || 'master' }}
41+
PROCESS_VERSION=$(grep -Po '(?<=__version__ = ")[^"]+' tmp-process/CADETProcess/__init__.py || echo "dev")
42+
43+
CORE_TAG=${GITHUB_REF##*/} # Strip refs/tags/v1.2.3 → v1.2.3
44+
45+
echo "PYTHON_VERSION=$PYTHON_VERSION" >> $GITHUB_ENV
46+
echo "PROCESS_VERSION=$PROCESS_VERSION" >> $GITHUB_ENV
47+
echo "CORE_TAG=$CORE_TAG" >> $GITHUB_ENV
48+
49+
- name: Docker meta
50+
id: meta
51+
uses: docker/metadata-action@v5
52+
with:
53+
# list of Docker images to use as base name for tags
54+
images: |
55+
ghcr.io/cadet/CADET-Suite
56+
# generate Docker tags based on the following events/attributes
57+
tags: |
58+
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-') }} # Only set 'latest' if it's a tag AND NOT a pre-release
59+
type=ref,event=branch
60+
type=raw,value=Core-${{ env.CORE_TAG }}-Python-${{ env.PYTHON_VERSION }}-Process-${{ env.PROCESS_VERSION }}
61+
62+
- name: Login to GHCR
63+
if: github.event_name != 'pull_request'
64+
uses: docker/login-action@v3
65+
with:
66+
registry: ghcr.io
67+
username: ${{ github.repository_owner }}
68+
password: ${{ secrets.GITHUB_TOKEN }}
69+
70+
- name: Set up QEMU
71+
uses: docker/setup-qemu-action@v3
72+
73+
- name: Set up Docker Buildx
74+
uses: docker/setup-buildx-action@v3
75+
76+
- name: Build and push
77+
uses: docker/build-push-action@v6
78+
with:
79+
push: ${{ github.event_name != 'pull_request' }}
80+
tags: ${{ steps.meta.outputs.tags }}
81+
labels: ${{ steps.meta.outputs.labels }}
82+
build-args: |
83+
CADET_PYTHON_HASH=${{ github.event.inputs.cadet_python_hash || 'master' }}
84+
CADET_PROCESS_HASH=${{ github.event.inputs.cadet_process_hash || 'master' }}

Dockerfile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
ARG MINIFORGE_VERSION=24.11.3-2
2+
FROM condaforge/miniforge3:${MINIFORGE_VERSION} AS build
3+
WORKDIR /cadet
4+
5+
USER root
6+
7+
ARG DEBIAN_FRONTEND=noninteractive
8+
9+
RUN apt-get update && \
10+
apt-get -y install build-essential cmake libhdf5-dev libsuperlu-dev intel-mkl git git-lfs libeigen3-dev && \
11+
apt-get clean
12+
13+
COPY . CADET-Core
14+
WORKDIR CADET-Core
15+
16+
RUN mkdir -p build
17+
18+
WORKDIR build
19+
20+
SHELL ["/bin/bash", "-c"]
21+
22+
ENV MKLROOT=/opt/intel/mkl
23+
24+
RUN cmake -DCMAKE_INSTALL_PREFIX="../install" -DENABLE_STATIC_LINK_DEPS=ON -DENABLE_STATIC_LINK_LAPACK=ON -DBLA_VENDOR=Intel10_64lp_seq ../
25+
26+
RUN make -j $(lscpu | grep 'CPU(s)' | head -n 1 | cut -d ':' -f2 | tr -d ' ') install
27+
28+
RUN /cadet/CADET-Core/install/bin/createLWE -o /cadet/CADET-Core/install/bin/LWE.h5
29+
RUN /cadet/CADET-Core/install/bin/cadet-cli /cadet/CADET-Core/install/bin/LWE.h5
30+
31+
FROM condaforge/miniforge3:${MINIFORGE_VERSION} AS deploy
32+
COPY --from=build /cadet/CADET-Core/install /cadet/CADET-Core/install
33+
COPY --from=build /usr/lib/x86_64-linux-gnu/libsz.so.2 /cadet/CADET-Core/install/lib
34+
ENV PATH="$PATH:/cadet/CADET-Core/install/bin"
35+
36+
RUN apt-get update && \
37+
apt-get -y install libhdf5-dev libsuperlu-dev git git-lfs && \
38+
apt-get clean
39+
40+
# Ensure CADET-Core still works
41+
RUN cadet-cli --version
42+
43+
# CADET_PYTHON_HASH can be a branch name or a commit hash or vX.X.X
44+
ARG CADET_PYTHON_HASH=master
45+
RUN git clone https://github.com/cadet/CADET-Python /cadet/CADET-Python
46+
WORKDIR /cadet/CADET-Python
47+
RUN git checkout ${CADET_PYTHON_HASH}
48+
RUN pip install .
49+
50+
# CADET_PROCESS_HASH can be a branch name or a commit hash or vX.X.X
51+
ARG CADET_PROCESS_HASH=master
52+
RUN git clone https://github.com/fau-advanced-separations/CADET-Process /cadet/CADET-Process
53+
WORKDIR /cadet/CADET-Process
54+
RUN git checkout ${CADET_PROCESS_HASH}
55+
RUN pip install .
56+
57+
RUN pip install cadet-rdm
58+
59+
WORKDIR /tmp

0 commit comments

Comments
 (0)