Skip to content

Commit

Permalink
Move Docker image to hatch + compile
Browse files Browse the repository at this point in the history
- Move to hatch to build wheel
- Install wheel into venv we copy with colorama + d

Fixes #3928

Test:
- See we can get black to execute: TODO: Update when compiled is working
```
crl-m1:black cooper$ docker run --rm black_compiled black --version
black, 23.10.1.dev1+g882d879.d20231022 (compiled: no)
Python (CPython) 3.11.6
```
- Check size: TODO: Update when compiled
```
crl-m1:black cooper$ docker image ls | grep black_compiled
black_compiled                 latest            9db38fb7f1d0   4 minutes ago    180MB
```
  • Loading branch information
cooperlees committed Oct 22, 2023
1 parent 882d879 commit 61d67e1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Dockerfile
Expand Up @@ -3,12 +3,13 @@ FROM python:3.11-slim AS builder
RUN mkdir /src
COPY . /src/
ENV VIRTUAL_ENV=/opt/venv
# Install build tools to compile dependencies that don't have prebuilt wheels
RUN apt update && apt install -y build-essential git python3-dev
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 python -m pip install --no-cache-dir hatch
RUN . /opt/venv/bin/activate && pip install --no-cache-dir --upgrade pip setuptools \
&& cd /src && hatch build -t wheel \
&& pip install --no-cache-dir dist/*[colorama,d]

FROM python:3.11-slim

Expand Down

0 comments on commit 61d67e1

Please sign in to comment.