X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/fcf97961061982656a1384ecc1628e217a52a88c..b40b01ffe3dbf1fa989acd6050ef5e61c085b5da:/Dockerfile?ds=inline diff --git a/Dockerfile b/Dockerfile index a03d23a..4e8f12f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,19 @@ -FROM python:3 +FROM python:3-slim AS builder -ENV PYTHONDONTWRITEBYTECODE 1 -ENV PYTHONUNBUFFERED 1 +RUN mkdir /src +COPY . /src/ +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] -RUN pip install --upgrade --no-cache-dir black +FROM python:3-slim -ENTRYPOINT /usr/local/bin/black --check --diff . +# 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"]