Move Docker image to hatch + compile (#3965)
This commit is contained in:
parent
7f1c578b89
commit
d291c2338c
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
<!-- Changes to how Black is packaged, such as dependency requirements -->
|
<!-- Changes to how Black is packaged, such as dependency requirements -->
|
||||||
|
|
||||||
|
- Change Dockerfile to hatch + compile black (#3965)
|
||||||
|
|
||||||
### Parser
|
### Parser
|
||||||
|
|
||||||
<!-- Changes to the parser or to version autodetection -->
|
<!-- Changes to the parser or to version autodetection -->
|
||||||
|
12
Dockerfile
12
Dockerfile
@ -3,12 +3,14 @@ FROM python:3.11-slim AS builder
|
|||||||
RUN mkdir /src
|
RUN mkdir /src
|
||||||
COPY . /src/
|
COPY . /src/
|
||||||
ENV VIRTUAL_ENV=/opt/venv
|
ENV VIRTUAL_ENV=/opt/venv
|
||||||
|
ENV HATCH_BUILD_HOOKS_ENABLE=1
|
||||||
|
# Install build tools to compile black + dependencies
|
||||||
|
RUN apt update && apt install -y build-essential git python3-dev
|
||||||
RUN python -m venv $VIRTUAL_ENV
|
RUN python -m venv $VIRTUAL_ENV
|
||||||
RUN . /opt/venv/bin/activate && pip install --no-cache-dir --upgrade pip setuptools wheel \
|
RUN python -m pip install --no-cache-dir hatch hatch-fancy-pypi-readme hatch-vcs
|
||||||
# Install build tools to compile dependencies that don't have prebuilt wheels
|
RUN . /opt/venv/bin/activate && pip install --no-cache-dir --upgrade pip setuptools \
|
||||||
&& apt update && apt install -y git build-essential \
|
&& cd /src && hatch build -t wheel \
|
||||||
&& cd /src \
|
&& pip install --no-cache-dir dist/*-cp*[colorama,d,uvloop]
|
||||||
&& pip install --no-cache-dir .[colorama,d]
|
|
||||||
|
|
||||||
FROM python:3.11-slim
|
FROM python:3.11-slim
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@ created for all unreleased
|
|||||||
[commits on the `main` branch](https://github.com/psf/black/commits/main). This tag is
|
[commits on the `main` branch](https://github.com/psf/black/commits/main). This tag is
|
||||||
not meant to be used by external users.
|
not meant to be used by external users.
|
||||||
|
|
||||||
|
From version 23.11.0 the Docker image installs a compiled black into the image.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
A permanent container doesn't have to be created to use _Black_ as a Docker image. It's
|
A permanent container doesn't have to be created to use _Black_ as a Docker image. It's
|
||||||
|
Loading…
Reference in New Issue
Block a user