instructions for config.yaml

rework of docker

its ALIVE

disable :ro tag for config.yaml

leave empty line

lets open ports instead of network mode host

run as current user

run as user

nevermind

update readme with instructions

relocate docker section
This commit is contained in:
Michael Gillett
2026-03-01 16:18:50 -05:00
parent d24bcb1f43
commit 908b1c39db
3 changed files with 45 additions and 58 deletions

View File

@@ -202,6 +202,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 for an example.
```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
@@ -249,12 +260,6 @@ Pre-commit hooks will automatically:
- Lint with flake8
- Fix trailing whitespace and other file issues
## Docker
```bash
docker build -t pymc:latest . --platform linux/arm/v7
```
## Support
- [Core Lib Documentation](https://rightup.github.io/pyMC_core/)

View File

@@ -3,14 +3,13 @@ services:
build: .
container_name: pymc-repeater
restart: unless-stopped
ports:
- 8000:8000
devices:
- /dev/spidev0.0
- /dev/spidev0.1
- /dev/gpiochip0
cap_add:
- SYS_RAWIO
volumes:
- ./config.yaml:/etc/pymc_repeater/config.yaml:ro
- pymc_data:/var/lib/pymc_repeater
ports:
- "8000:8000"
volumes:
pymc_data:
- ./config.yaml:/etc/pymc_repeater/config.yaml
- ./data:/var/lib/pymc_repeater

View File

@@ -1,52 +1,35 @@
# ---------------------------
# Builder stage
# ---------------------------
FROM python:3.11-alpine AS builder
FROM python:3.12-slim-bookworm
WORKDIR /build
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
# Build dependencies
RUN apk add --no-cache \
build-base \
linux-headers \
python3-dev
# 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/*
COPY pyproject.toml .
# Create runtime directories
RUN mkdir -p ${INSTALL_DIR} ${CONFIG_DIR} ${DATA_DIR}
WORKDIR ${INSTALL_DIR}
# Copy source
COPY repeater ./repeater
COPY pyproject.toml .
# Build wheels (including spidev)
RUN pip wheel --no-cache-dir --wheel-dir /wheels .
# ---------------------------
# Runtime stage
# ---------------------------
FROM python:3.11-alpine
ENV PYTHONUNBUFFERED=1 \
CONFIG_PATH=/etc/pymc_repeater/config.yaml
ARG UID=10001
ARG GID=10001
# Create non-root user
RUN addgroup -g ${GID} repeater && \
adduser -D -u ${UID} -G repeater repeater
WORKDIR /opt/pymc_repeater
# Copy wheels from builder
COPY --from=builder /wheels /wheels
# Install from wheels only
RUN pip install --no-cache-dir /wheels/* && \
rm -rf /wheels
# Config directory
RUN mkdir -p /etc/pymc_repeater && \
chown -R ${UID}:${GID} /etc/pymc_repeater
USER ${UID}:${GID}
# Install package
RUN pip install --no-cache-dir .
EXPOSE 8000
ENTRYPOINT ["/bin/sh", "-c", "test -f ${CONFIG_PATH} || (echo 'Missing config.yaml' && exit 1); exec python3 -m repeater --config ${CONFIG_PATH}"]
ENTRYPOINT ["python3", "-m", "repeater.main", "--config", "/etc/pymc_repeater/config.yaml"]