Question regarding docker build, i'm looking at th...
# general
a
Question regarding docker build, i'm looking at the following example: https://github.com/ehiggs/pants-poetry-test-repos/tree/master/multirepo-2 In this approach, I'm basically not using any feature of docker cache at all, because everything done by: "RUN ./pants package "$APPLICATION" Isn't this disadvantage too big?
b
I’m not in a position to provide a tonne of info sorry, but https://blog.pantsbuild.org/optimizing-python-docker-deploys-using-pants/ might be of interest, with how it runs a bunch of the build outside of docker
c
instead of having
RUN ./pants package "$APPLICATION"
you can do `COPY path.to.application/binary.pex /bin/app`to copy in the built PEX. Pants uses dependency inference to package the PEX binary. by default this includes all the dependencies, so you can skip the
RUN pip3 install -r requirements.txt
(and all the engineering time optimising it to not cache the wheels). We have a handful of small apps and found that was fine speed-wise since we hit the Pants cache instead of the docker cache. We found that there was a bit of a slowdown because the PEX contains all of the dependencies as an opaque file, so we had to copy&upload&store MiB instead of KiB. That was only really a problem for us with 1 of our apps (it was an integration thing, so the only way to really dev was to push it into a staging env). We followed the steps in the article Huon linked to use 2 PEXes. Our dev throughput isn't very high, though, so our focus is really on Dev Experience rather than build performance.