From 1fae3addaa635259c4b8d9e28410b9837548058e Mon Sep 17 00:00:00 2001 From: Erik Parmann Date: Fri, 4 Jan 2019 15:12:25 +0100 Subject: [PATCH] Improve docker caching in Dockerfile-ModelServer Moved the adding of build.sh to the end, so the ModelServer dockerfile shares as many lines as possible with ModelBuilder, so their docker layers will be shared. --- Dockerfile-ModelBuilder | 11 ++++++----- Dockerfile-ModelServer | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Dockerfile-ModelBuilder b/Dockerfile-ModelBuilder index 85deb114e..8ad3543f8 100644 --- a/Dockerfile-ModelBuilder +++ b/Dockerfile-ModelBuilder @@ -16,15 +16,16 @@ FROM python:3.6.8-slim-stretch COPY requirements.txt /code/ RUN pip install -r /code/requirements.txt +# Install gordo-components, packaged from earlier 'python setup.py sdist' +COPY --from=builder /code/dist/gordo-components-packed.tar.gz . + +# Install gordo-components, packaged from earlier 'python setup.py sdist' +RUN pip install ./gordo-components-packed.tar.gz + ADD build.sh /code/build.sh # build.sh (build the model) as executable default command RUN cp /code/build.sh /usr/bin/build \ && chmod +x /usr/bin/build -# Install gordo-components, packaged from earlier 'python setup.py sdist' -COPY --from=builder /code/dist/gordo-components-packed.tar.gz . - -RUN pip install ./gordo-components-packed.tar.gz - CMD ["build"] diff --git a/Dockerfile-ModelServer b/Dockerfile-ModelServer index 7509223ca..d604c12fb 100644 --- a/Dockerfile-ModelServer +++ b/Dockerfile-ModelServer @@ -16,6 +16,7 @@ FROM python:3.6.8-slim-stretch COPY requirements.txt /code/ RUN pip install -r /code/requirements.txt +# Install gordo-components, packaged from earlier 'python setup.py sdist' COPY --from=builder /code/dist/gordo-components-packed.tar.gz . # Install gordo-components, packaged from earlier 'python setup.py sdist'