AndreMiras / EtherollApp

Provably fair dice game running on the Ethereum blockchain
MIT License
57 stars 22 forks source link

Docker image caching not fully leveraged #160

Closed AndreMiras closed 4 years ago

AndreMiras commented 4 years ago

For instance see build https://travis-ci.org/AndreMiras/EtherollApp/jobs/597317675 It uses the cache until before the COPY Makefile ${WORK_DIR} command. Same can be reproduced locally by pulling the image and building it locally. Then if I ran both containers and do a sha1sum of the Makefile, it's the same. So I'm not sure why this would not pick the cache. This is annoying because it could speed up the android build/test on CI which currently runs in ~30 minutes. See more build log context below:

$ make docker/build/$TAG
docker build --cache-from=andremiras/etherollapp-android --tag=andremiras/etherollapp-android --file=dockerfiles/Dockerfile-android .
Sending build context to Docker daemon  1.512MB
Step 1/21 : FROM ubuntu:18.04
18.04: Pulling from library/ubuntu
5667fdb72017: Already exists
d83811f270d5: Already exists
ee671aafb583: Already exists
7fc152dfb3a6: Already exists
Digest: sha256:1bbdea4846231d91cce6c7ff3907d26fca444fd6b7e3c282b90c7fe4251f9f86
Status: Downloaded newer image for ubuntu:18.04
 ---> 2ca708c1c9cc
Step 2/21 : ENV USER="user"
 ---> Using cache
 ---> a20318372855
Step 3/21 : ENV HOME_DIR="/home/${USER}"
 ---> Using cache
 ---> f0b469cd7946
Step 4/21 : ENV WORK_DIR="${HOME_DIR}"     PATH="${HOME_DIR}/.local/bin:${PATH}"
 ---> Using cache
 ---> aaf0ab3072e8
Step 5/21 : ENV DOCKERFILES_VERSION="develop"     DOCKERFILES_URL="https://raw.githubusercontent.com/AndreMiras/dockerfiles"
 ---> Using cache
 ---> 6c256244c72f
Step 6/21 : ENV MAKEFILES_URL="${DOCKERFILES_URL}/${DOCKERFILES_VERSION}/buildozer_android"
 ---> Using cache
 ---> 8eb535d37eec
Step 7/21 : RUN apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends     locales &&     locale-gen en_US.UTF-8
 ---> Using cache
 ---> d9cadb1aec09
Step 8/21 : ENV LANG="en_US.UTF-8"     LANGUAGE="en_US.UTF-8"     LC_ALL="en_US.UTF-8"
 ---> Using cache
 ---> 7f5df29b8808
Step 9/21 : RUN apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends     lsb-release     make     sudo
 ---> Using cache
 ---> 7b0f5b055ba1
Step 10/21 : RUN useradd --create-home --shell /bin/bash ${USER}
 ---> Using cache
 ---> a26632937afe
Step 11/21 : RUN usermod -append --groups sudo ${USER}
 ---> Using cache
 ---> cfd9e2c64971
Step 12/21 : RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
 ---> Using cache
 ---> a80e3fcaa411
Step 13/21 : USER ${USER}
 ---> Using cache
 ---> e9a11eba55c5
Step 14/21 : WORKDIR ${WORK_DIR}
 ---> Using cache
 ---> 68ee75c8f5bd
Step 15/21 : COPY Makefile ${WORK_DIR}
 ---> 78407d1eb4b9
Step 16/21 : RUN sudo make system_dependencies_android
 ---> Running in 075c20dba5d2
sudo apt update -qq > /dev/null && sudo apt install --yes --no-install-recommends autoconf automake bsdtar ca-certificates curl libffi-dev libltdl-dev libpython3.7-dev libtool openjdk-8-jdk python2.7 python3.7 python3-pip python3-setuptools sudo unzip xz-utils zip
AndreMiras commented 4 years ago

Problem seems to be with DockerHub automatic builds and its way to deal with COPY command I assume. If I push the image myself then I don't get cache bust. It means we cannot use the automatic builds if we want to fully leverage the cache.

AndreMiras commented 4 years ago

Fixed via ea81423