Skip to content

Commit 468c6a9

Browse files
committed
Added build
0 parents  commit 468c6a9

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

build/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ubuntu:18.04
2+
ENV LANG C.UTF-8
3+
RUN apt-get update && apt-get install -y \
4+
python3 \
5+
pkg-config \
6+
python3-pip \
7+
git \
8+
build-essential \
9+
python3-numpy \
10+
python3-scipy \
11+
python3-mpi4py \
12+
swig \
13+
libopenmpi-dev \
14+
openmpi-bin \
15+
ccache \
16+
&& rm -rf /var/lib/apt/lists/* \
17+
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 10 \
18+
&& /usr/sbin/update-ccache-symlinks \
19+
&& echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc
20+
21+
# Copies your code file from your action repository to the filesystem path `/` of the container
22+
COPY compileSU2.sh /compileSU2.sh
23+
24+
# Code file to execute when the docker container starts up (`entrypoint.sh`)
25+
ENTRYPOINT ["/compileSU2.sh"]

build/compileSU2.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/sh -l
2+
3+
echo "SU2 v7 Docker Compilation Container"
4+
usage="$(basename "$0") [-h] [-f build_flags] [-b branch_name]
5+
where:
6+
-h show this help text
7+
-f meson build flags (ignored if a directory \"docker_build\" is found at /src/SU2).
8+
-b branch name (if not given, existing SU2 directory must be mounted in /src/SU2).
9+
10+
Compiled binaries can be found at /install/. Mount that directory for access.
11+
Note: If you specify a working directory using the --workdir option for docker,
12+
append this directory to all paths above (e.g. use --workdir=/tmp if running in user mode)."
13+
14+
flags=""
15+
branch=""
16+
workdir=$PWD
17+
18+
export CCACHE_DIR=$workdir/ccache
19+
20+
if [ "$#" -ne 0 ]; then
21+
while [ "$(echo $1 | cut -c1)" = "-" ]
22+
do
23+
case "$1" in
24+
-f)
25+
flags=$2
26+
shift 2
27+
;;
28+
-b)
29+
branch=$2
30+
shift 2
31+
;;
32+
*)
33+
echo "$usage" >&2
34+
exit 1
35+
;;
36+
esac
37+
done
38+
fi
39+
40+
if [ ! -z "$branch" ]; then
41+
name="SU2_$(echo $branch | sed 's/\//_/g')"
42+
echo "Branch provided. Cloning to $PWD/src/$name"
43+
if [ ! -d "src" ]; then
44+
mkdir "src"
45+
fi
46+
cd "src"
47+
git clone --recursive https://github.com/su2code/SU2 $name
48+
cd $name
49+
git config --add remote.origin.fetch '+refs/pull/*/merge:refs/remotes/origin/refs/pull/*/merge'
50+
git config --add remote.origin.fetch '+refs/heads/*:refs/remotes/origin/refs/heads/*'
51+
git fetch origin
52+
git checkout $branch
53+
git submodule update
54+
else
55+
if [ ! -d "src/SU2" ]; then
56+
echo "SU2 source directory not found. Make sure to mount existing SU2 at directory at /src/SU2. Otherwise use -b to provide a branch."
57+
exit 1
58+
fi
59+
cd src/SU2
60+
fi
61+
62+
if [ ! -d "docker_build" ]; then
63+
./meson.py docker_build --prefix=$workdir/install $flags
64+
else
65+
echo "Build Directory found. Ignoring build flags. To set new flags, remove docker_build directory."
66+
./meson.py docker_build --reconfigure $flags
67+
fi
68+
69+
./ninja -C docker_build install
70+
71+

0 commit comments

Comments
 (0)