diff --git a/Dockerfile b/Dockerfile index 9cac362..b3fc1bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,10 +57,14 @@ COPY docs/ ./docs/ COPY pyproject.toml . COPY README.md . -# Create non-root user matching the host uid/gid (passed via build args) +# Create non-root user matching the host uid/gid (passed via build args). +# ubuntu:24.04 ships a default 'ubuntu' user/group at uid/gid 1000, so remove +# it first to free those ids before creating astrai. ARG USER_UID=1000 ARG USER_GID=1000 -RUN groupadd -g "${USER_GID}" astrai \ +RUN userdel -r ubuntu 2>/dev/null || true \ + && groupdel ubuntu 2>/dev/null || true \ + && groupadd -g "${USER_GID}" astrai \ && useradd -m -u "${USER_UID}" -g astrai astrai \ && chown -R astrai:astrai /app ENV HOME=/home/astrai