diff --git a/README.md b/README.md index e11fa8c..17c10a6 100644 --- a/README.md +++ b/README.md @@ -316,6 +316,17 @@ This script will: The script will prompt you for each optional removal step. +## Docker + +You can now run PyMC Repeater from within a [Docker Container](https://www.docker.com/). Checkout the example [Docker Compose](./docker-compose.yml) file before you get started. + +```bash +docker compose up -d --force-recreate --build +``` + +Just note that you will have to pass in a `config.yaml` into the container. You can create a new config by following the instructions in the [Configuration section](#configuration). + + ## Roadmap / Planned Features - [ ] **Public Map Integration** - Submit repeater location and details to public map for discovery @@ -363,8 +374,6 @@ Pre-commit hooks will automatically: - Lint with flake8 - Fix trailing whitespace and other file issues - - ## Support - [Core Lib Documentation](https://rightup.github.io/pyMC_core/) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f65a1de --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +services: + pymc-repeater: + build: . + container_name: pymc-repeater + restart: unless-stopped + ports: + - 8000:8000 + devices: + - /dev/spidev0.0 + - /dev/gpiochip0 + cap_add: + - SYS_RAWIO + volumes: + - ./config.yaml:/etc/pymc_repeater/config.yaml + - ./data:/var/lib/pymc_repeater diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..8d3689f --- /dev/null +++ b/dockerfile @@ -0,0 +1,35 @@ +FROM python:3.12-slim-bookworm + +ENV INSTALL_DIR=/opt/pymc_repeater \ + CONFIG_DIR=/etc/pymc_repeater \ + DATA_DIR=/var/lib/pymc_repeater \ + PYTHONUNBUFFERED=1 \ + SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYMC_REPEATER=1.0.5 + +# Install runtime dependencies only +RUN apt-get update && apt-get install -y \ + libffi-dev \ + python3-rrdtool \ + jq \ + wget \ + swig \ + git \ + build-essential \ + python3-dev \ + && rm -rf /var/lib/apt/lists/* + +# Create runtime directories +RUN mkdir -p ${INSTALL_DIR} ${CONFIG_DIR} ${DATA_DIR} + +WORKDIR ${INSTALL_DIR} + +# Copy source +COPY repeater ./repeater +COPY pyproject.toml . + +# Install package +RUN pip install --no-cache-dir . + +EXPOSE 8000 + +ENTRYPOINT ["python3", "-m", "repeater.main", "--config", "/etc/pymc_repeater/config.yaml"]