1
1
FROM rockylinux:9.1 AS base
2
2
ENV TROUTE_REPO=CIROH-UA/t-route
3
- ENV TROUTE_BRANCH=datastream
3
+ ENV TROUTE_BRANCH=ngiab
4
4
ENV NGEN_REPO=CIROH-UA/ngen
5
5
ENV NGEN_BRANCH=ngiab
6
6
7
- # Install system dependencies
7
+ # Install final dependencies to make sure ngen is build and deployed with matching versions
8
+ # Needed here for build caching
8
9
RUN echo "max_parallel_downloads=10" >> /etc/dnf/dnf.conf
9
10
RUN dnf update -y && \
10
11
dnf install -y epel-release && \
11
12
dnf config-manager --set-enabled crb && \
12
13
dnf install -y \
13
- sudo vim gcc gcc-c++ make cmake ninja-build tar git gcc-gfortran libgfortran sqlite sqlite-devel \
14
+ vim libgfortran sqlite \
15
+ bzip2 expat udunits2 zlib \
16
+ mpich hdf5 netcdf netcdf-fortran netcdf-cxx netcdf-cxx4-mpich
17
+
18
+ FROM base AS build_base
19
+ # no dnf update to keep devel packages consistent with versions installed in base
20
+ RUN echo "max_parallel_downloads=10" >> /etc/dnf/dnf.conf
21
+ RUN dnf install -y epel-release && \
22
+ dnf config-manager --set-enabled crb && \
23
+ dnf install -y \
24
+ sudo gcc gcc-c++ make cmake ninja-build tar git gcc-gfortran libgfortran sqlite sqlite-devel \
14
25
python3 python3-devel python3-pip gdal gdal-devel \
15
- bzip2 expat expat -devel flex bison udunits2 udunits2-devel zlib-devel \
16
- wget mpich mpich -devel hdf5 hdf5 -devel netcdf netcdf-devel \
17
- netcdf-fortran netcdf-fortran- devel netcdf-cxx netcdf-cxx-devel lld
26
+ expat-devel flex bison udunits2-devel zlib-devel \
27
+ wget mpich-devel hdf5-devel netcdf-devel \
28
+ netcdf-fortran- devel netcdf-cxx-devel lld
18
29
19
30
20
31
21
- FROM base AS boost_build
32
+ FROM build_base AS boost_build
22
33
RUN wget https://archives.boost.io/release/1.79.0/source/boost_1_79_0.tar.gz
23
34
RUN tar -xzf boost_1_79_0.tar.gz
24
35
WORKDIR /boost_1_79_0
@@ -61,7 +72,7 @@ RUN ./compiler.sh no-e
61
72
# install / build using UV because it's so much faster
62
73
# no build isolation needed because of cython namespace issues
63
74
RUN uv pip install --config-setting='--build-option=--use-cython' src/troute-network/
64
- RUN uv build --wheel --config-setting='--build-option=--use-cython' src/troute-network/
75
+ RUN uv build --wheel --config-setting='--build-option=--use-cython' src/troute-network/
65
76
RUN uv pip install --no-build-isolation --config-setting='--build-option=--use-cython' src/troute-routing/
66
77
RUN uv build --wheel --no-build-isolation --config-setting='--build-option=--use-cython' src/troute-routing/
67
78
RUN uv build --wheel --no-build-isolation src/troute-config/
@@ -97,7 +108,7 @@ ARG COMMON_BUILD_ARGS="-DNGEN_WITH_EXTERN_ALL=ON \
97
108
-DCMAKE_BUILD_TYPE=Release \
98
109
-DCMAKE_INSTALL_PREFIX=. \
99
110
-DCMAKE_CXX_FLAGS='-fuse-ld=lld'"
100
- # lld is the linker, it's faster than the default
111
+ # lld is the linker, it's faster than the default
101
112
102
113
103
114
# Build Ngen serial
@@ -108,8 +119,8 @@ ARG MPI_BUILD_ARGS="-DNGEN_WITH_MPI:BOOL=ON \
108
119
-DNetCDF_ROOT=/usr/lib64/mpich \
109
120
-DCMAKE_PREFIX_PATH=/usr/lib64/mpich \
110
121
-DCMAKE_LIBRARY_PATH=/usr/lib64/mpich/lib"
111
- # the two in the command below can't be here because the $() isn't evaulated properly
112
-
122
+ # the two in the command below can't be here because the $() isn't evaulated properly
123
+
113
124
114
125
# Install the mpi enabled netcdf library and build Ngen parallel with it
115
126
RUN dnf install -y netcdf-cxx4-mpich-devel
@@ -149,17 +160,7 @@ ENTRYPOINT ["./HelloNGEN.sh"]
149
160
150
161
151
162
152
- FROM rockylinux:9.1 AS final
153
- # Install only necessary runtime dependencies
154
- RUN echo "max_parallel_downloads=10" >> /etc/dnf/dnf.conf
155
- RUN dnf update -y && \
156
- dnf install -y epel-release && \
157
- dnf config-manager --set-enabled crb && \
158
- dnf install -y \
159
- vim libgfortran sqlite gdal \
160
- bzip2 expat udunits2 zlib \
161
- mpich hdf5 netcdf netcdf-fortran netcdf-cxx netcdf-cxx4-mpich && \
162
- dnf clean all
163
+ FROM base AS final
163
164
164
165
WORKDIR /ngen
165
166
@@ -190,7 +191,7 @@ RUN chmod a+x /dmod/bin/* /ngen/HelloNGEN.sh
190
191
# This mess is parsing the version number
191
192
RUN uv pip install numpy==$(/dmod/bin/ngen --info | grep -e 'NumPy Version: ' | cut -d ':' -f 2 | uniq | xargs)
192
193
193
- # now that the only version of numpy is the one that NGen expects,
194
+ # now that the only version of numpy is the one that NGen expects,
194
195
# we can add the venv to the path so ngen can find it
195
196
ENV PATH="/ngen/.venv/bin:${PATH}"
196
197
0 commit comments