@@ -14,18 +14,9 @@ RUN mkdir -p $PIP_CACHE_DIR
1414ARG USERNAME
1515LABEL org.opencontainers.image.source=https://github.com/OpenJKSoftware/python-devcontainer
1616
17- # Install uv
18- COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
19- ENV UV_CACHE_DIR=/var/cache/uv \
20- UV_PYTHON_CACHE_DIR=/var/cache/uv/python \
21- UV_LINK_MODE=copy \
22- UV_COMPILE_BYTECODE=1
23- RUN set -x; mkdir -p $UV_CACHE_DIR && mkdir -p $UV_PYTHON_CACHE_DIR
24- RUN --mount=type=cache,target=/var/cache uv python install ${PYTHONVERSION} --default
25-
2617# Install Base Reqs
2718COPY scripts/install_base_deps.sh /tmp/
28- RUN /tmp/install_base_deps.sh
19+ RUN --mount=type=cache,target=/var/cache/apt /tmp/install_base_deps.sh
2920
3021# Create User and setup environment
3122RUN useradd --shell /usr/bin/zsh --create-home ${USERNAME} -u 1000 \
@@ -34,6 +25,11 @@ RUN useradd --shell /usr/bin/zsh --create-home ${USERNAME} -u 1000 \
3425 && chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
3526ENV EDITOR=nvim
3627
28+ # Sudo Support
29+ RUN set -x; \
30+ apt-get -y install --no-install-recommends sudo \
31+ && echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
32+
3733# Fix Locale issues
3834RUN set -x; \
3935 apt-get install locales -y --no-install-recommends \
@@ -47,11 +43,14 @@ RUN set -x; \
4743COPY known_hosts /root/.ssh/known_hosts
4844COPY --chown=${USERNAME}:${USERNAME} known_hosts /home/${USERNAME}/.ssh/known_hosts
4945
50- # Sudo Support
51- RUN set -x; \
52- apt-get -y install --no-install-recommends sudo \
53- && echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
54-
46+ # Install uv
47+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
48+ ENV UV_CACHE_DIR=/var/cache/uv \
49+ UV_PYTHON_CACHE_DIR=/var/cache/uv/python \
50+ UV_LINK_MODE=copy \
51+ UV_COMPILE_BYTECODE=1
52+ RUN set -x; mkdir -p $UV_CACHE_DIR && mkdir -p $UV_PYTHON_CACHE_DIR
53+ RUN --mount=type=cache,target=/var/cache uv python install ${PYTHONVERSION} --default
5554
5655# Non Root User
5756USER ${USERNAME}
@@ -63,6 +62,4 @@ RUN set -x ; \
6362 && sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
6463COPY --chown=${USERNAME}:${USERNAME} .zshrc .zshrc
6564
66-
67- RUN sudo bash -c "rm -rf {./*,/tmp/*,/var/cache/apt/*,/var/lib/apt/lists/*,$PIP_CACHE_DIR/*}"
6865ENTRYPOINT [ "/usr/bin/zsh" ]
0 commit comments