X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/8e0803e7e5acabdd28b80258f15d8aebf11fbb4c..bd961304b63ad8178610df7242edf180d825e336:/Dockerfile

diff --git a/Dockerfile b/Dockerfile
index 9542479..c393e29 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,14 +1,17 @@
-FROM python:3-slim
+FROM python:3-slim AS builder
 
 RUN mkdir /src
 COPY . /src/
 RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
-    && apt update && apt install -y git \
+    # 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 --user --no-cache-dir .[colorama,d]
+
+FROM python:3-slim
+
+# copy only Python packages to limit the image size
+COPY --from=builder /root/.local /root/.local
+ENV PATH=/root/.local/bin:$PATH
 
 CMD ["black"]