We demonstrate how you can combine Stata with Wolfram Engine into a single Docker image.
Note that this could also include installing Pandoc or LaTeX, if needed, for Stata.
- Edit the
init.config.txtto have the desired values for the Docker image you will create:
VERSION=17
# the TAG can be anything, but could be today's date
TAG=$(date +%F)
MYHUBID=larsvilhuber
MYIMG=${PWD##*/}
STATALIC=/path/to/stata.lic
where
-
VERSIONis the Stata version you want to use (this might be ignored right now) -
TAGis the Docker tag you will be using - could be "latest", could be a specific name. Has to be lower-case. -
MYHUBIDis presumably your Docker login -
MYIMGis the name you want to give the Docker image you are creating. By default, it presumes that it will be the same name as the Git repository. -
STATALICis the path to a valid Stata license file (for instance, as installed on your laptop) -
Edit the
Dockerfile. The primary configuration parameters are at the top:
ARG SRCVERSION=17
ARG SRCTAG=2022-01-17
ARG SRCHUBID=dataeditors
ARG WOLFRAMVERSION=latest
where
-
SRCVERSIONis the Stata version you want to use -
SRCTAGis the tag of the Stata version you want to use as an input -
SRCHUBIDis where the Stata image comes from - should probably not be modified, but you could use your own. -
WOLFRAMVERSIONis used to pin thewolframresearch/wolframengine:WOLFRAMVERSIONversioned image. Adjust as necessary (e.g., "latest", "14.3") -
Finally, edit the
setup.dofile, which will install any Stata packages into the image.
Use build.sh (NAME OF STATA LICENSE FILE), e.g.
./build.sh
On first use, you need to activate Wolfram Engine with your Wolfram ID credentials. Use the activation script:
./activate_wolfram.sh
You will be prompted to enter your Wolfram ID and password. The activation will be saved to $HOME/.WolframEngine/Licensing on your host machine and will be automatically mounted in future runs.
Note: You need a (free) Wolfram Engine developer license. Sign up at https://www.wolfram.com/developer-license
You also need the Stata license for running it all. For convenience, use the run.sh script:
./run.sh
The run script automatically:
- Mounts your Stata license file
- Mounts your Wolfram Engine licensing directory (from
$HOME/.WolframEngine/Licensing) - Maps the code and data directories