-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathpyfvcom.def
More file actions
64 lines (52 loc) · 1.82 KB
/
pyfvcom.def
File metadata and controls
64 lines (52 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Bootstrap: docker
From: condaforge/mambaforge:latest
%labels
Author mib
Description "PyFVCOM container"
%help
This container includes a conda environment created via mamba from the provided environment.yml
and an editable installation of pyfvcom cloned from:
https://github.com/pmlmodelling/pyfvcom.git
The environment name is 'pyfvcom'. At runtime, the environment is on PATH automatically.
%files
environment.yaml /opt/environment.yaml
%environment
# Ensure the pyfvcom conda environment is active on PATH at runtime
export CONDA_PREFIX="/opt/conda"
export ENV_NAME="pyfvcom"
export ENV_PATH="$CONDA_PREFIX/envs/$ENV_NAME"
if [ -d "$ENV_PATH" ]; then
export PATH="$ENV_PATH/bin:$PATH"
export CONDA_DEFAULT_ENV="$ENV_NAME"
fi
%post
# Basic build tools and git
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
git \
build-essential \
ca-certificates \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Convenience env vars
CONDA_PREFIX="/opt/conda"
ENV_NAME="pyfvcom"
ENV_PATH="$CONDA_PREFIX/envs/$ENV_NAME"
# Make sure conda is initialized for non-interactive shells
. "$CONDA_PREFIX/etc/profile.d/conda.sh"
# Clone and install pyfvcom
mkdir -p /opt/src
cd /opt/src
git clone -b dev https://github.com/pmlmodelling/pyfvcom.git
cd pyfvcom
mamba env create -f ./environment.yaml -n "$ENV_NAME"
# Clean up conda pkgs cache to slim image (optional)
conda clean -afy
%runscript
# Default run: open python within the pyfvcom environment
exec python "$@"
%test
# Sanity check: python and pyfvcom importable
set -e
python -c "import sys; print(sys.version)"
python -c "import PyFVCOM; print('pyfvcom version OK')"