install build-essential to compile dependencies and use multi-stage build (#2582)
- 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
This commit is contained in:
parent
b21c0c3d28
commit
bd961304b6
@ -25,8 +25,8 @@
|
|||||||
### Integrations
|
### Integrations
|
||||||
|
|
||||||
- Allow to pass `target_version` in the vim plugin (#1319)
|
- 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
|
- Install build tools in docker file and use multi-stage build to keep the image size
|
||||||
(#2579)
|
down (#2582)
|
||||||
|
|
||||||
## 21.9b0
|
## 21.9b0
|
||||||
|
|
||||||
|
19
Dockerfile
19
Dockerfile
@ -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
|
RUN mkdir /src
|
||||||
COPY . /src/
|
COPY . /src/
|
||||||
RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
|
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 --user --no-cache-dir .[colorama,d]
|
||||||
&& pip install --no-cache-dir .[colorama,d] \
|
|
||||||
&& rm -rf /src \
|
FROM python:3-slim
|
||||||
&& apt remove -y git \
|
|
||||||
&& apt autoremove -y \
|
# copy only Python packages to limit the image size
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
COPY --from=builder /root/.local /root/.local
|
||||||
|
ENV PATH=/root/.local/bin:$PATH
|
||||||
|
|
||||||
CMD ["black"]
|
CMD ["black"]
|
||||||
|
Loading…
Reference in New Issue
Block a user