-
Notifications
You must be signed in to change notification settings - Fork 142
Expand file tree
/
Copy pathDockerfile
More file actions
70 lines (60 loc) · 2.16 KB
/
Dockerfile
File metadata and controls
70 lines (60 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
ARG TARGET
ARG CC_COMPILER
ARG CXX_COMPILER
ARG FC_COMPILER
ARG COMPILER_PATH
ARG COMPILER_LD_LIBRARY_PATH
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
RUN apt-get update -y && \
apt-get install -y software-properties-common ca-certificates gnupg wget && \
add-apt-repository ppa:deadsnakes/ppa && \
apt-get update -y && \
if [ "$TARGET" = "cpu" ]; then \
apt-get install -y \
build-essential git make cmake gcc g++ gfortran bc \
python3.12 python3.12-venv python3-pip \
openmpi-bin libopenmpi-dev libfftw3-dev \
mpich libmpich-dev; \
elif [ "$TARGET" = "gpu" ]; then \
apt-get install -y \
build-essential git make cmake bc \
python3.12 python3.12-venv python3-pip \
libfftw3-dev \
openmpi-bin libopenmpi-dev; \
fi && \
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 2 && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV OMPI_ALLOW_RUN_AS_ROOT=1
ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
ENV HYDRA_LAUNCHER=fork
ENV PATH="/opt/MFC:$PATH"
COPY ../ /opt/MFC
ENV CC=${CC_COMPILER}
ENV CXX=${CXX_COMPILER}
ENV FC=${FC_COMPILER}
ENV PATH="${COMPILER_PATH}:/opt/mpich/bin:$PATH"
ENV LD_LIBRARY_PATH="${COMPILER_LD_LIBRARY_PATH}:/opt/mpich/lib:${LD_LIBRARY_PATH:-}"
# Pre-install numpy into the venv before mfc.sh runs, as it's required at
# build time by several dependencies (pandas, cantera, matplotlib, etc.) that
# may need to compile from source on architectures without pre-built wheels
RUN python3.12 -m venv /opt/MFC/build/venv && \
/opt/MFC/build/venv/bin/pip install --upgrade pip && \
/opt/MFC/build/venv/bin/pip install numpy
RUN echo "TARGET=$TARGET CC=$CC_COMPILER FC=$FC_COMPILER" && \
cd /opt/MFC && \
if [ "$TARGET" = "gpu" ]; then \
./mfc.sh build --gpu acc -j $(nproc); \
else \
./mfc.sh build -j $(nproc); \
fi
RUN cd /opt/MFC && \
if [ "$TARGET" = "gpu" ]; then \
./mfc.sh test -a --dry-run --gpu acc -j $(nproc); \
else \
./mfc.sh test -a --dry-run -j $(nproc); \
fi
WORKDIR /opt/MFC
ENTRYPOINT ["tail", "-f", "/dev/null"]