diff --git a/Dockerfile b/Dockerfile index 53ce3ab..2f9f64f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,11 @@ FROM python:3.11-slim +# Backwards compatible defaults +ENV USER=root +ENV GROUPNAME=root +ENV UID=0 +ENV GID=0 + SHELL ["/bin/bash", "-ec"] RUN apt update && apt install --no-install-recommends -y bluez build-essential @@ -9,4 +15,6 @@ RUN python3 -m venv /opt/venv && \ pip install --upgrade --extra-index-url=https://www.piwheels.org/simple pip TheengsGateway==1.5.0 COPY chroot / -CMD source /opt/venv/bin/activate && exec /opt/venv/start.sh +CMD (getent group "${GROUPNAME}" || groupadd -g "${GID}" "${GROUPNAME}") && \ + (getent passwd "${USER}" || useradd -u "${UID}" -g "${GID}" -m "${USER}") && \ + su -l -s "/bin/bash" -c "source /opt/venv/bin/activate && exec /opt/venv/start.sh" "${USER}"