Open marco-c opened 5 years ago
Taskboot cannot use docker-squash
for now anyway...
We wouldn't need to squash with multistage builds
I had this version based on slim, but was not convinced by the size enhancements:
#syntax=docker/dockerfile:experimental
ARG PYTHON_VERSION=3.7.3-slim
FROM python:${PYTHON_VERSION} as build
# Install bugbug requirements as wheels
WORKDIR /wheels
COPY requirements.txt /requirements.txt
RUN apt-get update && \
apt-get install -y gcc g++ && \
pip wheel --disable-pip-version-check -r /requirements.txt && \
# Restart build from a slim image
FROM python:${PYTHON_VERSION}
# Import wheels
COPY --from=build /wheels /tmp/wheels
# Setup bugbug with a bind RO mount
RUN --mount=type=bind,target=/tmp/bugbug \
apt-get update && \
apt-get install libgomp1 && \
pip install -f /tmp/wheels /tmp/bugbug && \
rm -rf /tmp/wheels
With a multistage build we can have small Docker images without causing caching problems with squashing multiple comands in one layer.