# Containers

`husk build --docker` generates a Dockerfile that packages your skills folder and serves it with HUSK. The container runs the exact same skills you developed locally.

```bash
husk build --docker
```

This writes a `Dockerfile` (and a `.dockerignore` if absent):

```dockerfile
FROM oven/bun:1
WORKDIR /app

# Install the HUSK CLI globally.
RUN bun add -g @elisym/husk

# If your kernels need other runtimes (python3, ffmpeg, ...), install them here:
# RUN apt-get update && apt-get install -y python3 && rm -rf /var/lib/apt/lists/*

COPY skills ./skills

ENV HUSK_PORT=3000
EXPOSE 3000
CMD ["husk", "serve", "skills", "--host", "0.0.0.0", "--port", "3000"]
```

## Build and run

```bash
docker build -t my-skills .
docker run -p 3000:3000 my-skills
```

## Options

| Flag             | Default  | Notes                                   |
| ---------------- | -------- | --------------------------------------- |
| `[dir]`          | `skills` | Skills directory copied into the image. |
| `-p, --port <p>` | `3000`   | Port the container serves on.           |
| `--force`        | off      | Overwrite an existing `Dockerfile`.     |

:::warning
A fresh `Dockerfile` is never overwritten unless you pass `--force`, so your customizations are safe.
:::

## Kernel dependencies

The base image is `oven/bun:1`, which has Bun but not much else. If a kernel needs another runtime or system tool - `python3`, `ffmpeg`, `rembg`, ImageMagick - install it in the Dockerfile before the `COPY` line. The generated file includes a commented `apt-get` example to start from.

```dockerfile
RUN apt-get update && apt-get install -y python3 ffmpeg && rm -rf /var/lib/apt/lists/*
```

## Passing secrets

Kernels inherit the server's environment, so provide API keys at run time rather than baking them into the image:

```bash
docker run -p 3000:3000 -e ANTHROPIC_API_KEY=sk-... my-skills
```
