Skip to content

Commit 21b3504

Browse files
committed
Merge pull request #32 in LCL/wolframengineforpython from feature/ECE-553-add-Dockerfile to master
* commit '0960225dc4855a8efc4d41cb537066b9d21fc12f': Change `pip3` to `python3 -m pip` in Dockerfile Add some linebreaks to README.md Condense some RUN commands in the Dockerfile Add information on Docker image to README.md Add Dockerfile
2 parents debf874 + 0960225 commit 21b3504

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM wolframresearch/wolframengine:latest
2+
3+
USER root
4+
5+
RUN apt-get update -y && \
6+
apt-get install -y python3 python3-pip && \
7+
python3 -m pip install wolframclient
8+
9+
COPY . /tmp/build
10+
RUN pip3 install /tmp/build && \
11+
rm -r /tmp/build && \
12+
chown -R wolframengine /srv
13+
14+
USER wolframengine
15+
EXPOSE 18000
16+
17+
ENTRYPOINT ["/usr/bin/python3", "-m", "wolframwebengine", "--domain", "0.0.0.0"]
18+
CMD ["/srv"]

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,33 @@ http://localhost:18000/static.json
148148
One advantage of a multi-file application structure is that is very easy to extend the application. You can simply place new files into the appropriate location in your application directory and they will automatically be served.
149149

150150

151+
## Using Docker
152+
153+
Wolfram Web Engine for Python is available as [a container image from Docker Hub](https://hub.docker.com/r/wolframresearch/wolframwebengineforpython) for use in containerized environments.
154+
155+
This image is based on the [official Wolfram Engine Docker image](https://hub.docker.com/r/wolframresearch/wolframengine); information on product activation and license terms
156+
is available on the [Docker Hub page](https://hub.docker.com/r/wolframresearch/wolframengine) for the latter image.
157+
158+
```
159+
# exposes the server on port 8080 of the host machine
160+
>>> docker run -ti -p 8080:18000 wolframresearch/wolframwebengineforpython --demo
161+
162+
# serve files from the /srv directory
163+
>>> docker run -ti -p 8080:18000 wolframresearch/wolframwebengineforpython /srv
164+
```
165+
166+
The commands above do not include activation/licensing configuration; see the [official Wolfram Engine Docker image](https://hub.docker.com/r/wolframresearch/wolframengine) for information on activating the Wolfram Engine kernel.
167+
168+
169+
Note regarding on-demand licensing: As Wolfram Web Engine for Python does not use WolframScript, the `-entitlement` command-line option and the `WOLFRAMSCRIPT_ENTITLEMENTID`
170+
environment variable cannot be used to pass an on-demand license entitlement ID to the Wolfram Engine kernel inside this image.
171+
As a workaround, the `WOLFRAMINIT` environment variable can be set to pass both the entitlement ID and the license server address to the kernel:
172+
173+
```
174+
>>> docker run -ti -p 8080:18000 --env WOLFRAMINIT='-pwfile !cloudlm.wolfram.com -entitlement O-WSTD-DA42-GKX4Z6NR2DSZR' wolframresearch/wolframwebengineforpython --demo
175+
```
176+
177+
151178
## Options
152179

153180
```

0 commit comments

Comments
 (0)