X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/d5c95f6a8f274f42cce81bfe544266a7bb53474b..refs/heads/master:/.vim/bundle/black/Dockerfile?ds=sidebyside diff --git a/.vim/bundle/black/Dockerfile b/.vim/bundle/black/Dockerfile index 9542479..a9e0ea5 100644 --- a/.vim/bundle/black/Dockerfile +++ b/.vim/bundle/black/Dockerfile @@ -1,14 +1,19 @@ -FROM python:3-slim +FROM python:3.11-slim AS builder RUN mkdir /src COPY . /src/ -RUN pip install --no-cache-dir --upgrade pip setuptools wheel \ - && apt update && apt install -y git \ +ENV VIRTUAL_ENV=/opt/venv +RUN python -m venv $VIRTUAL_ENV +RUN . /opt/venv/bin/activate && pip install --no-cache-dir --upgrade pip setuptools wheel \ + # Install build tools to compile dependencies that don't have prebuilt wheels + && apt update && apt install -y git build-essential \ && cd /src \ - && pip install --no-cache-dir .[colorama,d] \ - && rm -rf /src \ - && apt remove -y git \ - && apt autoremove -y \ - && rm -rf /var/lib/apt/lists/* + && pip install --no-cache-dir .[colorama,d] -CMD ["black"] +FROM python:3.11-slim + +# copy only Python packages to limit the image size +COPY --from=builder /opt/venv /opt/venv +ENV PATH="/opt/venv/bin:$PATH" + +CMD ["/opt/venv/bin/black"]