docker: add gpio and spi groups

This commit is contained in:
Yellowcooln
2026-05-27 20:02:22 -04:00
parent 00682e8086
commit a308ddc00d
3 changed files with 25 additions and 4 deletions
+9 -2
View File
@@ -5,6 +5,8 @@ ARG USER=repeater
ARG GROUP=repeater
ARG PUID=15888
ARG PGID=15888
ARG GPIO_GID=986
ARG SPI_GID=989
ARG TARGETARCH
ARG YQ_VERSION=v4.40.5
@@ -16,7 +18,9 @@ ENV INSTALL_DIR=/opt/pymc_repeater \
PYTHONUNBUFFERED=1 \
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYMC_REPEATER=${PACKAGE_VERSION} \
PUID=${PUID} \
PGID=${PGID}
PGID=${PGID} \
GPIO_GID=${GPIO_GID} \
SPI_GID=${SPI_GID}
# Install runtime dependencies only
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
@@ -45,7 +49,10 @@ RUN arch="${TARGETARCH:-}" \
# Create the group and user in order to run without root privileges
RUN groupadd --gid "$PGID" "$GROUP" \
&& useradd --uid "$PUID" --gid "$PGID" --home-dir "$HOME_DIR" --create-home --shell /usr/bin/bash "$USER"
&& groupadd --gid "$GPIO_GID" gpio \
&& groupadd --gid "$SPI_GID" spi \
&& useradd --uid "$PUID" --gid "$PGID" --home-dir "$HOME_DIR" --create-home --shell /usr/bin/bash "$USER" \
&& usermod -a -G gpio,spi "$USER"
# Create runtime directories
RUN mkdir -p ${INSTALL_DIR} ${CONFIG_DIR} ${DATA_DIR} \