From 8e0803e7e5acabdd28b80258f15d8aebf11fbb4c Mon Sep 17 00:00:00 2001 From: Cooper Lees Date: Wed, 7 Apr 2021 21:13:11 -0700 Subject: [PATCH] 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 --- Dockerfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9542479 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3-slim + +RUN mkdir /src +COPY . /src/ +RUN pip install --no-cache-dir --upgrade pip setuptools wheel \ + && apt update && apt install -y git \ + && cd /src \ + && pip install --no-cache-dir .[colorama,d] \ + && rm -rf /src \ + && apt remove -y git \ + && apt autoremove -y \ + && rm -rf /var/lib/apt/lists/* + +CMD ["black"] -- 2.39.5