The information in this repository is now out of date, as it relates to APSIM Classic release 7.9. Please see https://github.com/APSIMInitiative/APSIMClassic for up to date versions.
This container builds APSIM Classic, and creates a self-extracting binary as an artifact, which is then used for the Runtime container. The following comments explain the logic behind how the Build container was created.
APSIM's documentation is quite terse, and scattered all over the place. There are no step-by-step build/install instructions, so a lot of guess-work is required. The general flow is:
- Download the source code using subversion from the upstream server (https://apsrunet.apsim.info/svn/apsim/trunk/)
- Install OS's pre-requisites as listed under Compiling under LINUX, making sure to use Mono 4.6 or 4.8
- Install the required R packages
- Install pre-requisites not listed as needed (based on trial and error by attemptimg the build several times)
- Run the
BuildAll.sh
script underModel/Build
- Export the APSIM environment variable pointing to the right location, and create a self-extracting archive for distribution with
Release/Release.sh
- Run the self-extracting archive, optionally specifying a destination path
- Export
LD_LIBRARY_PATH
to the location of$apsim_path/Model
mono Apsim.exe
is the main program.ApsimModel.exe
is a native (libc) application. See this thread for more info.
- Ubuntu:Xenial was chosen, but Debian:Wheezy would probably work as well
- We need Mono 4.6 or 4.8 based on the comments by the developer (Peter deVoil [email protected])
- APSIM apparently needs
/etc/localtime
to run so we have to install tzdata. While we're are it, we configure our local timezone - Subversion is needed to pull the source code. The while loop works around an issue where
svn co
dies with a "Connection reset by peer" error- TODO: It may be better to pre-download the source code and mount it as a volume when the container runs
- TODO: We could use ENV variables to choose and build a different release from upstream
p7zip-full
is needed to provide7z
, used by the Cotton model Makefilep7zip
is needed to provide7zr
, used by theRelease.sh
which creates the self-extracting artifactmono-vbnc
is needed to provideSystem.Windows.Forms, Version=4.0.0.0
(used byApsimToSim.exe
)libmonosgen-2.0-1
is needed to providelibmonosgen-2.0-1
(used byApsimModel.exe
)- The file
CottonPassword.txt
is hardcoded on the Cotton model Makefile and expected to be found under/etc/CottonPassword.txt
. The file was provided by the developer (Dean Holzworth [email protected]). YOU MUST GET THE PASSWORD FROM THE DEVELOPERS or the Docker build will fail. Alternatively, you can also disable building the model by commenting out theCompile Cotton
section infiles/BuildAll.xml
- These files have been hacked so that the build actually works
Model/TclLink/Makefile
andModel/RLink/Makefile.linux
: PrependedProcessDataTypesInterface.exe
withmono
instead of calling it directly, so that we don't have to use bimfmt as described hereModel/Build/BuildAll.xml
: Disabled building unit tests (requires NUnit v3 for which there is no Debian package and installing from source feels like an overkill)