Commit 6ad9195b authored by Ramon Nou's avatar Ramon Nou
Browse files

Merge branch 'rnou/351-preparing-new-docker-for-0-9-5' into 'master'

Resolve "preparing new docker for 0.9.5"

Closes #351

Closes #351

See merge request !243
parents 3047ea07 bc59a45c
Loading
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -34,12 +34,8 @@ FetchContent_Declare(nlohmann_json
    DOWNLOAD_EXTRACT_TIMESTAMP ON
    URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz)

FetchContent_GetProperties(nlohmann_json)

if (NOT nlohmann_json_POPULATED)
    FetchContent_Populate(nlohmann_json)
    message(STATUS "[gkfs.io] Nlohmann JSON source dir: ${nlohmann_json_SOURCE_DIR}")
    message(STATUS "[gkfs.io] Nlohmann JSON binary dir: ${nlohmann_json_BINARY_DIR}")
FetchContent_MakeAvailable(nlohmann_json)

    # we don't really care so much about a third party library's tests to be
    # run from our own project's code
@@ -48,5 +44,3 @@ if (NOT nlohmann_json_POPULATED)
    # we also don't need to install it when our main project gets installed
    set(JSON_Install OFF CACHE INTERNAL "")
    add_subdirectory(${nlohmann_json_SOURCE_DIR} ${nlohmann_json_BINARY_DIR})
endif ()
+72 −0
Original line number Diff line number Diff line
FROM gekkofs/testing:0.9.5 AS builder

LABEL Description="Build environment for S3D-IO and WaComM++"

ARG DEBIAN_FRONTEND=noninteractive

RUN <<EOF
    apt-get update
    apt-get install -y --no-install-recommends \
    openmpi-bin openmpi-common gfortran libopenmpi-dev pnetcdf-bin libpnetcdf-dev libssl-dev wget nco nghttp2
    rm -rf /var/lib/apt/lists/* 
    apt-get clean
    apt-get autoclean
EOF

# --- Build S3D-IO ---
WORKDIR /build/S3D-IO
RUN git clone https://github.com/wkliao/S3D-IO.git . && \
    # Note: The PNETCDF_DIR and include path might need adjustment if libpnetcdf-dev installs to a different standard location
    # or if the base image structure changes.
    sed -i -e 's/PNETCDF_DIR = ${HOME}\/PNetCDF/PNETCDF_DIR = \/usr/' \
            -e 's/\(INC[[:space:]]*=[[:space:]]*-I\$(PNETCDF_DIR)\/include\)/\1 -I\/usr\/lib\/x86_64-linux-gnu\/fortran\/gfortran-mod-15/' Makefile && \
    make && \
    mv s3d_io.x /usr/local/bin/s3d_io.x

# --- Build wacommplusplus ---
WORKDIR /build/wacommplusplus
RUN git clone https://github.com/CCMMMA/wacommplusplus.git . && \
    sed -i 's|\${LIBCURL}|/usr/lib/x86_64-linux-gnu/libcurl.so|g' CMakeLists.txt && \
    mkdir build && cd build && \
    cmake .. && \
    make -j$(nproc) && \
    mv wacommplusplus /usr/local/bin/wacommplusplus && \
    mv external /usr/local/lib/

# ---- Final Stage ----
FROM gekkofs/testing:0.9.5

LABEL Description="Debian-based environment to test GekkoFS with apps"
ARG DEBIAN_FRONTEND=noninteractive

# Install runtime dependencies
# libpnetcdf13 (or similar, check exact name with 'apt-cache search libpnetcdf')
# libssl might be libssl1.1 or libssl3 depending on Debian version in base image
RUN apt-get update && apt-get install -y --no-install-recommends \
    openmpi-bin openmpi-common libopenmpi-dev pnetcdf-bin libssl3 libcurl4 \
    wget nco nghttp2 \
    && rm -rf /var/lib/apt/lists/* \
    && apt-get clean && \
    mkdir -p /root/wacommplusplus/build/example /root/S3D-IO

# Copy built applications from the builder stage
COPY --from=builder /usr/local/bin/s3d_io.x /root/S3D-IO
COPY --from=builder /usr/local/bin/wacommplusplus /root/wacommplusplus/build
COPY --from=builder /usr/local/lib/external /root/wacommplusplus/build/external/


WORKDIR /root/wacommplusplus/build/example
RUN mkdir -p input processed output restarts && \
    cd input && \
    wget -q https://api.meteo.uniparthenope.it/files/rms3/d03/history/2025/01/01/rms3_d03_20250101Z0000.nc && \
    mv rms3_d03_20250101Z0000.nc input.nc && \
    ncks -7 -L 9 --qnt default=1 --ppc default=1 input.nc rms3_d03_20250101Z0000.nc && \
    tar cvzf rms.tar.gz rms3_d03_20250101Z0000.nc && \
    rm rms3_d03_20250101Z0000.nc input.nc

# Copy configuration files
# These files (sources.json, wacomm.json) should be in the same directory as your Dockerfile
COPY sources.json /root/wacommplusplus/build/example
COPY wacomm.json /root/wacommplusplus/build/example

ENV LD_LIBRARY_PATH=/root/wacommplusplus/build/external/lib/
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
.PHONY: all

amd64:
	docker build --platform amd64 -t gekkofs/apps:0.9.5 .

aarch64:
	docker build --platform aarch64 -t gekkofs/apps:0.9.5 .

all:
	docker build -t gekkofs/apps:0.9.5 .
+27 −0
Original line number Diff line number Diff line
{
    "type": "FeatureCollection",
    "crs": {
        "type": "name",
        "properties": {
            "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
        }
    },
    "features": [
        {
            "type": "Feature",
            "properties": {
                "start": -1.0,
                "end": -1.0,
                "mode": 1,
                "particlesPerHour": 100,
                "depth": 0.0,
                "id": "1"
            },
            "geometry": {
                "type": "Point",
                "coordinates": [
                    14.972061,
                    40.343286
                ]
            }
        } ] }
 No newline at end of file
+46 −0
Original line number Diff line number Diff line
{
    "io": {
    "base_path": "/root/wacommplusplus/build/example/input",
    "history_root": "/root/wacommplusplus/build/example/restarts/",
    "mask_output": true,
    "nc_input_root": "/root/wacommplusplus/build/example/input/rms3_d03",
    "nc_inputs": [
                    "rms3_d03_20250101Z0000.nc"
            ],
    "nc_output_root": "/root/wacommplusplus/build/example/output/wacomm_his_",
    "ocean_model": "ROMS",
    "save_history": "json",
    "save_input": false,
    "timestep": 3600
},
"physics": {
    "horizontal_closure": "kill",
    "lower_closure": "kill",
    "random": true,
    "random_sources": true,
    "shore_limit": 0.5,
    "sigma": 3.46,
    "survprob": 0.0001,
    "sv": 0,
    "tau0": 86400.0,
    "upper_closure": "reflection"
},
"restart": {
    "active": false,
    "interval": 3600,
    "restart_file": ""
},
"simulation": {
    "dry": false,
    "end": "20250101Z00",
    "hours": 24,
    "institution": "meteo@uniparthenope - Department of Science and Technologies, University of Naples Parthenope",
    "name": "WaComM++",
    "start": "20250101Z01",
    "url": "https://meteo.uniparthenope.it"
},
"sources": {
    "active": true,
    "sources_file": "sources.json" 
}
}
 No newline at end of file
Loading