Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install build-essential to compile dependencies and use multi-stage build #2582

Merged
merged 4 commits into from Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGES.md
Expand Up @@ -24,8 +24,8 @@
### 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

Expand Down
19 changes: 10 additions & 9 deletions 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
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 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"]