Environments

Dockerfiles

If there's a Dockerfile in your project directory, Unweave will automatically detect it when uploading the ZeplContext, and use it to build your environment. We'll still automatically build your code to run in a Python environment if you don't provide one.

Example Dockerfile

Here's an example of what your Dockerfile could look like. It uses an official Python base image and installs dependencies from the requirements.txt file in your project directory. The CMD here will be overridden by the command you use to run the zepl. i.e. when you run unweave -- python main.py --lr 0.05, it will override the python main.py from the CMD instruction.

FROM python:3.7

WORKDIR /home/unweave

ADD ./requirements.txt ./requirements.txt
RUN pip install -r requirements.txt

ENV PYTHONUNBUFFERED=1

ADD . .

CMD ["python", "main.py"]

Caveats when using a custom Dockerfile

There are a couple of caveats to using your own Dockerfile:

  1. You must set the WORKDIR to /home/unweave - this where your code runs and where the uwstore is mounted.

  2. If you’re running a Python project, you must set the PYTHONUNBUFFERED=1 environment variable as shown in the example above. Otherwise, Python will wait for your process to exit before flushing out any logs. If you're using another language you should also check to see if stdout is flushed.

Previous
Time Sequence Prediction