Skip to content

Commit

Permalink
Fix: Remove MKL_jll-related warnings and reduce Docker build time
Browse files Browse the repository at this point in the history
- Added explicit installation and precompilation of MKL_jll in the Dockerfile to resolve warnings about missing precompiled modules during container startup.
- Precompiled MKL_jll and IntelOpenMP artifacts during the build phase, significantly reducing precompilation time from 18 minutes to 9 minutes by avoiding on-the-fly precompilation.
- The time reduction is attributed to precompiling MKL_jll in advance, preventing the heavy processing load that would otherwise occur during runtime.

- Added gdal-bin, libgdal-dev, and libfftw3-dev to the Dockerfile to support system dependencies required for geospatial and scientific computations.
  • Loading branch information
Pascal Omondiagbe committed Oct 25, 2024
1 parent 443c214 commit 47584a2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# See https://hub.docker.com/_/julia for valid versions.
ARG JULIA_VERSION="1.10.5"
ARG JULIA_VERSION="1.11.1"

#------------------------------------------------------------------------------
# internal-base build target: julia with OS updates and an empty @reefguide
Expand All @@ -22,10 +22,14 @@ RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
git \
less \
nano \
gdal-bin \
libgdal-dev \
libfftw3-dev \
&& apt-get clean \
&& apt-get autoremove --purge \
&& rm -rf /var/lib/apt/lists/*


# Tweak the JULIA_DEPOT_PATH setting so that our shared environments will end up
# in a user-agnostic location, not in ~/.julia => /root/.julia which is the default.
# See https://docs.julialang.org/en/v1/manual/environment-variables/#JULIA_DEPOT_PATH
Expand Down Expand Up @@ -104,7 +108,11 @@ ENV JULIA_CPU_TARGET=x86_64;haswell;skylake;skylake-avx512;tigerlake
WORKDIR "${REEFGUIDE_SRC_DIR}"
COPY ./Project.toml ./Project.toml
COPY ./Manifest.toml ./Manifest.toml
RUN julia --project=@reefguide -e 'using Pkg; Pkg.instantiate(verbose=true)'
# Pre-download and cache MKL_jll dependency before general precompilation
RUN julia -e 'using Pkg; Pkg.add("MKL_jll"); Pkg.instantiate(); using MKL_jll'

# Precompile Julia packages using BuildKit cache for better efficiency
RUN julia --project=@reefguide -e 'using Pkg; Pkg.instantiate(); Pkg.precompile()'

# Install the ReefGuideAPI source code and configure it as a development
# package in the @reefguide shared environment.
Expand All @@ -122,4 +130,4 @@ EXPOSE 8000

# Run Julia commands by default as the container launches.
# Derived applications should override the command.
ENTRYPOINT ["julia", "--project=@reefguide", "-t", "auto,1", "-e", "using ReefGuideAPI; ReefGuideAPI.start_server(\"/data/reefguide/config.toml\")"]
ENTRYPOINT ["julia", "--project=@reefguide", "-t", "auto,1", "-e", "using ReefGuideAPI; ReefGuideAPI.start_server(\"/data/reefguide/config.toml\")"]

0 comments on commit 47584a2

Please sign in to comment.