@@ -14,18 +14,11 @@ 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,sharing=locked \
20+ --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
21+ /tmp/install_base_deps.sh
2922
3023# Create User and setup environment
3124RUN useradd --shell /usr/bin/zsh --create-home ${USERNAME} -u 1000 \
@@ -34,8 +27,17 @@ RUN useradd --shell /usr/bin/zsh --create-home ${USERNAME} -u 1000 \
3427 && chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
3528ENV EDITOR=nvim
3629
30+ # Sudo Support
31+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
32+ --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
33+ set -x; \
34+ apt-get -y install --no-install-recommends sudo \
35+ && echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
36+
3737# Fix Locale issues
38- RUN set -x; \
38+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
39+ --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
40+ set -x; \
3941 apt-get install locales -y --no-install-recommends \
4042 && echo "LC_ALL=en_US.UTF-8" >> /etc/environment \
4143 && echo "LANG=en_US.utf-8" >> /etc/environment \
@@ -47,11 +49,14 @@ RUN set -x; \
4749COPY known_hosts /root/.ssh/known_hosts
4850COPY --chown=${USERNAME}:${USERNAME} known_hosts /home/${USERNAME}/.ssh/known_hosts
4951
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-
52+ # Install uv
53+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
54+ ENV UV_CACHE_DIR=/var/cache/uv \
55+ UV_PYTHON_CACHE_DIR=/var/cache/uv/python \
56+ UV_LINK_MODE=copy \
57+ UV_COMPILE_BYTECODE=1
58+ RUN set -x; mkdir -p $UV_CACHE_DIR && mkdir -p $UV_PYTHON_CACHE_DIR
59+ RUN --mount=type=cache,target=/var/cache uv python install ${PYTHONVERSION} --default
5560
5661# Non Root User
5762USER ${USERNAME}
@@ -63,6 +68,4 @@ RUN set -x ; \
6368 && sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
6469COPY --chown=${USERNAME}:${USERNAME} .zshrc .zshrc
6570
66-
67- RUN sudo bash -c "rm -rf {./*,/tmp/*,/var/cache/apt/*,/var/lib/apt/lists/*,$PIP_CACHE_DIR/*}"
6871ENTRYPOINT [ "/usr/bin/zsh" ]
0 commit comments