diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7fe5658 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +.git +__pycache__ +*.pyc +*.pyo +config.json +screenshots/ +.claude/ +CLAUDE.md +*.swp +*.swo +.DS_Store diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..49130cb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM python:3.11-slim + +RUN apt-get update && \ + apt-get install -y --no-install-recommends gcc python3-dev && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt && \ + apt-get purge -y gcc python3-dev && \ + apt-get autoremove -y && \ + rm -rf /var/lib/apt/lists/* + +COPY . . + +EXPOSE 2001 + +ENV PYTHONUNBUFFERED=1 + +CMD ["python3", "server.py"] diff --git a/README.md b/README.md index cd003aa..c6fa4cc 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,59 @@ python3 server.py On first run, visit http://localhost:2001 and the setup wizard will guide you through configuration. +## Docker / Podman + +### Prerequisites + +- [Docker](https://docs.docker.com/get-docker/) with Compose V2, **or** [Podman](https://podman.io/) with `podman-compose` + +### First Run + +```bash +# Create a config file (the setup wizard runs if you skip this) +cp config.json.example config.json + +# Build and start +docker compose up -d +``` + +The web UI is available at http://localhost:2001. + +### Useful Commands + +```bash +# View logs +docker compose logs -f + +# Stop +docker compose down + +# Rebuild after a git pull +docker compose build && docker compose up -d +``` + +### Podman + +The same `docker-compose.yml` works with Podman: + +```bash +podman-compose up -d +``` + +On SELinux systems (Fedora, RHEL), add `:Z` to each volume mount in `docker-compose.yml` so containers can access the bind-mounted files. + +### Data Persistence + +The following paths are bind-mounted from the repo directory and persist across container recreation: + +| Path | Contents | +|------|----------| +| `config.json` | Server configuration and credentials | +| `images/` | Aircraft and UI sprites (including uploads) | +| `backgrounds/` | Theme background images (including custom themes) | + +Host networking (`network_mode: host`) is used so the server can auto-scan your LAN for ADS-B receivers. + ## Requirements - Python 3.8+ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e162bde --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +services: + ads-bit: + build: . + container_name: ads-bit + network_mode: host + restart: unless-stopped + environment: + - PYTHONUNBUFFERED=1 + volumes: + # Persist config (copy config.json.example to config.json before first run) + - ./config.json:/app/config.json + # Persist custom sprite uploads + - ./images:/app/images + # Persist custom theme backgrounds + - ./backgrounds:/app/backgrounds