Commit Graph

10 Commits

Author SHA1 Message Date
Cooper Lees
3be19b306f
docker: Install the compiled wheel then install extras dependencies (#4357)
- Lets install black, then ask to install black with extrasC
  - pip sees black is installed and just installs extra dependencies

Test:
- Build local container
  - `docker build -t black_local .`
- Run blackd in container
  - `docker run -p 45484:45484 --rm black_local blackd --bind-host 0.0.0.0`
```
cooper@home1:~/repos/black$ docker run -p 45484:45484 --rm black_local blackd --bind-host 0.0.0.0
blackd version 24.4.3.dev11+gad60e62 listening on 0.0.0.0 port 45484
INFO:aiohttp.access:10.255.255.1 [10/May/2024:14:40:36 +0000] "GET / HTTP/1.1" 405 204 "-" "curl/8.5.0"

cooper@home1:~/repos/black$ curl http://10.6.9.2:45484
405: Method Not Allowed
```
- Test version is compiled
```
cooper@home1:~/repos/black$ docker run --rm black_local black --version
black, 24.4.3.dev11+gad60e62 (compiled: yes)
Python (CPython) 3.12.3
```

Fixes #4163
2024-05-10 08:23:10 -07:00
Cooper Lees
96faa3b469
[docker] Build with 3.12 image (#4055)
Test:
```
crl-m1:black cooper$ docker build --tag black_3_12 .
...
 => [stage-1 2/2] COPY --from=builder /opt/venv /opt/venv                                                                                                                                                  0.2s
 => exporting to image                                                                                                                                                                                     0.1s
 => => exporting layers                                                                                                                                                                                    0.1s
 => => writing image sha256:bd66acc9d76d2c40d287b0684ce6601401631e0468204c4e6a81f8f1eebaf1dd                                                                                                               0.0s
 => => naming to docker.io/library/black_3_12

crl-m1:black cooper$ docker image ls | grep black_3_12
black_3_12                     latest            bd66acc9d76d   59 seconds ago   193MB
```
2023-11-18 18:09:47 -08:00
Cooper Lees
d291c2338c
Move Docker image to hatch + compile (#3965) 2023-10-23 08:36:47 -07:00
Cooper Lees
738c2789cc
Set Docker to use 3.11 for now (#3927)
Until we get new aiohttp wheels we need to build with 3.11.
You can see an example of a fail here:

Workaround for #3919 - Will leave it open until we can move to 3.21
2023-10-06 11:39:20 -07:00
Nicolò Intrieri
f066e3fcae
makes install available for all users in docker image (#3202)
* makes install available for all users in docker image

moves the installation path from /root/.local to a
virtualenv. this way we still get the lightweight
multistage build without excluding non-root users.

* adds changelog entry for docker-image fix

A changelog entry has been added under the Integration
subheader

* changes dockerfile to use the venv activate script

we are now using the inbuilt venv activate script, as well
as explicitly mentioning the binary location in the entrypoint
cmd.

Co-authored-by: Nicolò <nicolo.intrieri@spinforward.it>
Co-authored-by: Cooper Lees <me@cooperlees.com>
2022-08-02 09:01:15 -07:00
Vincent Barbaresi
bd961304b6
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
2021-10-31 17:43:34 -07:00
Cooper Lees
7bf233a944
Pin regex in docker to 2021.10.8 (GH-2579)
* Pin regex in docker to 2021.10.8
- This is due to 2021.10.8 having arm wheels and newer versions not

I will go see if I can help restore arm build @ https://bitbucket.org/mrabarnett/mrab-regex/issues/399/missing-wheel-for-macosx-and-the-new-m1 soon.

Test: Build on my M1 mac: `docker build -t cooperlees/black .`

* Add in that the pin is only for docker
2021-10-31 13:41:12 -04:00
Cooper Lees
8e0803e7e5
Add black Dockerfile (#1916)
* Add `black` Dockerfile
- Build a `black` container based on python3-slim
- Test: `docker build --network-host --tag black .`
```console
cooper-mbp1:black cooper$ docker image ls
REPOSITORY                                         TAG            IMAGE ID       CREATED              SIZE
black                                              latest         0c7636402ac2   4 seconds ago        332MB
```

Addresses part of #1914

* Build with colorama + d extra installs - Adds ~9mb

* Combine all build commands in 1 run
- Combine the commands all into 1 RUN to down the size
- Get to 65.98 MB image size now: https://hub.docker.com/repository/docker/cooperlees/black/tags?page=1&ordering=last_updated

* Add rm -r of /var/lib/apt/lists/* + save 10mb down to 55mb
2021-04-07 21:13:11 -07:00
Hadi Alqattan
4d6a84a829
Allow black's Github action params overriding. (#1755)
* Allow default params overriding.

* Update: docs and action.yaml.

* The second contirbution, add my name to authors.md

* Correct docs `with.args` example.

* Just to rerun the Travis jobs.

* chmod 755
2020-10-18 14:24:33 -07:00
Hugo Barrera
fcf9796106
GitHub action (#1421)
* Implement a re-usable GitHub Action

Implement a GitHub action that can be reused across projects that want
to run black as part of their CI workflows.

* Fix typo in README.md

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Use latest Python 3

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2020-06-01 11:11:49 -07:00