Skip to content

Commit

Permalink
perf(dockerfile): bump the OS to bullseye and optimize the build
Browse files Browse the repository at this point in the history
 - Bump the Debian OS version from buster-slim to bullseye-slim, the current
   stable.
 - That OS bump speeds up installing numpy, since it can now be installed from
   a wheel instead of being compiled from source.
 - Add `MAKEFLAGS="-j$(nproc)"` in front of `pip install` to use all CPUs
   available in those cases where compilation from source is still required.
 - Reorder some instructions to improve docker cache hits.
 - Save the Dockerfile inside the image, for self-documentation purposes.
  • Loading branch information
joanise authored and roedoejet committed Mar 29, 2022
1 parent f6c1bed commit 20f1926
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# Base Image
FROM debian:buster-slim
FROM debian:bullseye-slim

ENV DEBIAN_FRONTEND=noninteractive

# Dependencies that don't change with g2p updates and can be cached
RUN apt-get update -y && apt-get install -y apt-transport-https
RUN apt-get install -y libffi-dev openssl libssl-dev python3 python3-pip python3-dev build-essential nano git

RUN mkdir /g2p
RUN mkdir /g2p/g2p
COPY g2p /g2p/g2p
# Get g2p-specific dependencies that can also often be cached
RUN mkdir -p /g2p/g2p
COPY requirements /g2p/requirements
COPY requirements.txt /g2p
COPY setup.py /g2p
COPY README.md /g2p
RUN MAKEFLAGS="-j$(nproc)" pip3 install -r /g2p/requirements.txt

# Get g2p-specific dependencies
RUN pip3 install -r /g2p/requirements.txt
# Install g2p itself, last
COPY g2p /g2p/g2p
COPY README.md /g2p
COPY Dockerfile /g2p
RUN pip3 install -e /g2p

# Comment this out if you just want to install g2p in the container without running the studio.
Expand Down

0 comments on commit 20f1926

Please sign in to comment.