check ubuntu user and set uv python dir (#3492)

This commit is contained in:
Wing Lian
2026-03-12 23:20:54 -04:00
committed by GitHub
parent 79908b3c6e
commit 083c5a0421
2 changed files with 11 additions and 1 deletions

View File

@@ -47,6 +47,14 @@ COPY .axolotl-complete.bash /home/ubuntu/.axolotl-complete.bash
RUN chmod +x /home/ubuntu/.axolotl-complete.bash && \
echo 'source /home/ubuntu/.axolotl-complete.bash' >> /home/ubuntu/.bashrc
# Ensure ubuntu user exists (may already exist from base image)
RUN id ubuntu &>/dev/null || ( \
useradd -m -s /bin/bash -u 1000 ubuntu && \
apt-get update && apt-get install -y --no-install-recommends sudo && rm -rf /var/lib/apt/lists/* \
); \
echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/ubuntu && \
chmod 0440 /etc/sudoers.d/ubuntu
RUN chown -R ubuntu:ubuntu /workspace /home/ubuntu
USER ubuntu

View File

@@ -27,7 +27,9 @@ RUN useradd -m -s /bin/bash -u 1000 ubuntu 2>/dev/null; \
echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/ubuntu && \
chmod 0440 /etc/sudoers.d/ubuntu
RUN uv python install ${PYTHON_VERSION}
ENV UV_PYTHON_INSTALL_DIR="/opt/uv/python"
RUN uv python install ${PYTHON_VERSION} && \
chmod -R a+rX /opt/uv
WORKDIR /workspace