Skip to content

Commit

Permalink
Merge pull request #32 in LCL/wolframengineforpython from feature/ECE…
Browse files Browse the repository at this point in the history
…-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
  • Loading branch information
okofish committed Apr 14, 2021
2 parents debf874 + 0960225 commit 21b3504
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM wolframresearch/wolframengine:latest

USER root

RUN apt-get update -y && \
apt-get install -y python3 python3-pip && \
python3 -m pip install wolframclient

COPY . /tmp/build
RUN pip3 install /tmp/build && \
rm -r /tmp/build && \
chown -R wolframengine /srv

USER wolframengine
EXPOSE 18000

ENTRYPOINT ["/usr/bin/python3", "-m", "wolframwebengine", "--domain", "0.0.0.0"]
CMD ["/srv"]
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,33 @@ http://localhost:18000/static.json
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.


## Using Docker

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.

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
is available on the [Docker Hub page](https://hub.docker.com/r/wolframresearch/wolframengine) for the latter image.

```
# exposes the server on port 8080 of the host machine
>>> docker run -ti -p 8080:18000 wolframresearch/wolframwebengineforpython --demo
# serve files from the /srv directory
>>> docker run -ti -p 8080:18000 wolframresearch/wolframwebengineforpython /srv
```

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.


Note regarding on-demand licensing: As Wolfram Web Engine for Python does not use WolframScript, the `-entitlement` command-line option and the `WOLFRAMSCRIPT_ENTITLEMENTID`
environment variable cannot be used to pass an on-demand license entitlement ID to the Wolfram Engine kernel inside this image.
As a workaround, the `WOLFRAMINIT` environment variable can be set to pass both the entitlement ID and the license server address to the kernel:

```
>>> docker run -ti -p 8080:18000 --env WOLFRAMINIT='-pwfile !cloudlm.wolfram.com -entitlement O-WSTD-DA42-GKX4Z6NR2DSZR' wolframresearch/wolframwebengineforpython --demo
```


## Options

```
Expand Down

0 comments on commit 21b3504

Please sign in to comment.