]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

install build-essential to compile dependencies and use multi-stage build (#2582)
authorVincent Barbaresi <vincent.barbaresi@datadoghq.com>
Mon, 1 Nov 2021 00:43:34 +0000 (01:43 +0100)
committerGitHub <noreply@github.com>
Mon, 1 Nov 2021 00:43:34 +0000 (17:43 -0700)
- Install build-essential to avoid build issues like #2568 when dependencies don't have prebuilt wheels available
- Use multi-stage build instead of trying to purge packages and cache from the image
  Copying `/root/.local/` installs only black's built Python dependencies (< 20 MB).
  So the image is barely larger than python:3-slim base image

CHANGES.md
Dockerfile

index 9990d8cf459ea8fadf19153b5bc019b280aa08cb..aa40d87ab71a8ffbcf35535fcdabdc92d0ec831d 100644 (file)
@@ -25,8 +25,8 @@
 ### Integrations
 
 - Allow to pass `target_version` in the vim plugin (#1319)
 ### Integrations
 
 - Allow to pass `target_version` in the vim plugin (#1319)
-- Pin regex module to 2021.10.8 in our docker file as it has arm wheels available
-  (#2579)
+- Install build tools in docker file and use multi-stage build to keep the image size
+  down (#2582)
 
 ## 21.9b0
 
 
 ## 21.9b0
 
index ce88f0ce5e30d1aff4c28f097f6ce501fbf31d49..c393e29f6320e951f155d137264f8798c317555f 100644 (file)
@@ -1,16 +1,17 @@
-FROM python:3-slim
+FROM python:3-slim AS builder
 
 
-# TODO: Remove regex version pin once we get newer arm wheels
 RUN mkdir /src
 COPY . /src/
 RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
 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 \
     && cd /src \
-    && pip install --no-cache-dir regex==2021.10.8 \
-    && 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"]
 
 CMD ["black"]