|
| 1 | +This guide will show you how to securely host the Cillow server using Docker, leveraging the Cillow base image for isolated and consistent deployments. |
| 2 | + |
| 3 | +--- |
| 4 | + |
| 5 | +### 1. **Prerequisites** |
| 6 | +- Docker installed on your system |
| 7 | +- A [`server.py`](https://github.com/synacktraa/cillow/blob/main/server.py) file to configure and run the Cillow server. This file sets up and starts the server, optionally with custom patches or configurations (see [Using Cillow guide](./quickstart/using_cillow.md)). |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +### 2. **Creating the Dockerfile** |
| 12 | +Create a `Dockerfile` in the same directory as your `server.py` file: |
| 13 | + |
| 14 | +```dockerfile |
| 15 | +FROM synacktra/cillow:latest |
| 16 | + |
| 17 | +# Uncomment the following line if you want cillow to use uv for package installation |
| 18 | +# COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv |
| 19 | + |
| 20 | +WORKDIR /app |
| 21 | + |
| 22 | +# Copy your server script into the container |
| 23 | +COPY server.py . |
| 24 | + |
| 25 | +# Expose the port the server will listen on |
| 26 | +EXPOSE 5556 |
| 27 | + |
| 28 | +# Define the command to start the server |
| 29 | +CMD ["python", "server.py"] |
| 30 | +``` |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +### 3. **Building the Docker Image** |
| 35 | +Run the following command to build the Docker image. The `-t` flag tags the image as `cillow-server`: |
| 36 | + |
| 37 | +```bash |
| 38 | +docker build -t cillow-server . |
| 39 | +``` |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +### 4. **Running the Docker Container** |
| 44 | +Launch the container using the built image. The `--init` flag ensures proper process handling, and `-it` keeps the container interactive: |
| 45 | + |
| 46 | +```bash |
| 47 | +docker run --init -it -p 5556:5556 --name cillow-server cillow-server |
| 48 | +``` |
| 49 | + |
| 50 | +This maps port `5556` from the container to your local machine, enabling client connections. |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +### 5. **Accessing the Sandboxed Server** |
| 55 | +Once the container is running, the Cillow server will be available at `localhost:5556`. Use `cillow.Client` to interact with the server as explained in the [Using Cillow guide](./quickstart/using_cillow.md#interacting-with-the-server). |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +### 6. **Customizing Your Server** |
| 60 | +Enhance your server with additional features by: |
| 61 | +- Adding custom patches |
| 62 | +- Configuring interpreter limits or other server parameters |
| 63 | + |
| 64 | +Simply modify your `server.py`, rebuild the Docker image, and restart the container with updated settings. |
0 commit comments