Running in Docker
Programmatic can be run in a Docker container. Here's how to get it set up.

Building

Create a directory containing the Dockerfile.
To build the image, run the following command in this directory:
1
docker build . -t programmatic
Copied!
This will build and tag programmatic:latest.

Running

The docker image can be used almost interchangeably with the humanloop CLI tool. However, there is some config that must be specified.
Assuming you have a host folder named /data, the following commands are examples:
Sanity-check the container works:
1
docker run programmatic:latest -- info
Copied!
Create a project, persisting the files to a directory on the host:
1
docker run -it --mount type=bind,source="$(pwd)"/data,target=/data programmatic:latest -- init /data/test_snips
Copied!
Run a project, persisting changes to a directory on the host, exposing the server on host port 80:
1
docker run -it -p80:80 --mount type=bind,source="$(pwd)"/data,target=/data programmatic:latest -- run /data/test_snips
Copied!
More complex setups are possible (E.g. using docker-compose).
On Windows, replace $(pwd) with %cd% in the above commands.

Dockerfile

1
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9
2
3
RUN pip install --upgrade pip
4
RUN pip install programmatic --extra-index-url "https://pypi.humanloop.com/simple"
5
6
ENV HUMANLOOP_HOST 0.0.0.0
7
ENV HUMANLOOP_PORT 80
8
EXPOSE 80
9
ENTRYPOINT ["humanloop"]
Copied!
Copy link