From 16bd1cb55f914b49c799902b71fbe28aa9a24190 Mon Sep 17 00:00:00 2001 From: Fern Garden Date: Sun, 7 Sep 2025 16:30:17 +0800 Subject: [PATCH] First commit. --- .gitignore | 2 ++ Dockerfile | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ compose.yaml | 13 +++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 compose.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a6d8c3c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/models +/.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ba7e053 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,48 @@ +FROM python:3.12-bookworm + +# Build args. +ARG UID=1001 +ARG GID=1001 + +# Update sources & upgrade packages. +RUN apt-get update -y +RUN apt-get upgrade -y + +# Install ExoPlaSim dependencies. +RUN apt-get install -y \ + build-essential gfortran \ + openmpi-bin libopenmpi-dev + +# Add python user. +RUN groupadd --force "${GID}" +RUN useradd --create-home --no-log-init -u "${UID}" -g "${GID}" python + +# Create build directory. +RUN mkdir /build && chown "${UID}:${GID}" /build +VOLUME /build + +# Add GUI ExoPlaSim configuration tool. +ADD https://github.com/OstimeusAlex/ExoPlaSim-InCon.git /utils/ + +# Add Koppen climate map tool. +ADD https://github.com/hersfeldtn/koppenpasta.git /utils/ + +# Execute as python user from now on. +USER python + +# Install python libraries. +RUN pip install --user --no-cache-dir --upgrade pip +RUN pip install --user --no-cache-dir \ + numpy \ + scipy \ + matplotlib \ + netcdf4 \ + h5py \ + pillow \ + exoplasim + +# Set working directory to build directory. +WORKDIR /build + +# Run model. +ENTRYPOINT [ "python", "./model.py" ] diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..07601a3 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,13 @@ +name: ExoPlaSim + +services: + exoplasim: + container_name: ExoPlaSim + user: "${UID:-1001}:${GID:-1001}" + build: + context: . + args: + UID: "${UID:-1001}" + GID: "${GID:-1001}" + volumes: + - "${MODEL:?error}:/build"