Skip to content

Commit

Permalink
Merge pull request #3 from yasuhito/feature/compact-devcontainer-image
Browse files Browse the repository at this point in the history
chore: make Docker image for devcontainer more compact
  • Loading branch information
snuffkin authored Dec 4, 2024
2 parents ee96e02 + 27974bd commit a1200c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 35 deletions.
37 changes: 5 additions & 32 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,7 @@
FROM debian:bookworm-slim AS builder
ARG UV_VERSION=0.5.5
ARG DEBIAN_VERSION=bookworm

WORKDIR /opt
FROM ghcr.io/astral-sh/uv:$UV_VERSION AS uv
FROM mcr.microsoft.com/vscode/devcontainers/base:$DEBIAN_VERSION

# The installer requires curl (and certificates) to download the release archive
# hadolint ignore=DL3008
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl gcc python3-dev graphviz

SHELL [ "/bin/bash", "-o", "pipefail", "-c" ]

# Download the latest installer
ADD https://astral.sh/uv/install.sh uv-installer.sh

# Run the installer then remove it
RUN sh uv-installer.sh


FROM mcr.microsoft.com/vscode/devcontainers/base:bookworm

ENV CARGO_HOME="/opt/.cargo/bin"
ENV PATH="$CARGO_HOME/:$PATH"

ENV PYTHONUNBUFFERED=True
ENV UV_LINK_MODE=copy

WORKDIR /opt

COPY --from=builder /root/.cargo/bin/uv $CARGO_HOME/uv
COPY ./.python-version ./

RUN uv python pin "$(cat .python-version)"

RUN chown -R vscode $CARGO_HOME
COPY --from=uv --chown=vscode: /uv /uvx /bin/
4 changes: 1 addition & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a1200c5

Please sign in to comment.