[Fuego] [PATCH 1/1] Dockerfile.test: various optimizations and fixes

Fathi Boudra fathi.boudra at linaro.org
Fri Apr 5 04:45:00 UTC 2019


On Fri, 5 Apr 2019 at 07:37, Dan Rue <dan.rue at linaro.org> wrote:
>
> On Thu, Apr 04, 2019 at 11:24:39AM +0300, Fathi Boudra wrote:
> > * Use a single RUN command to reduce the number of layers.
> > * Use ";\" style syntax instead of "&&\" to be able to write inline
> >   comments and make the file more readable.
>
> Curious about this one - doesn't changing && to ; change the behavior
> and potentially suppress errors? && is nice because errors are
> guaranteed to cause the build to fail.

it does but we have plenty of ways to determine if the docker image
build succeeded so I think the tradeoff is worth it  atm. Beside, it's
most likely going to be changed in future (patches in WIP) to reduce
code duplication, I'm working on a patchset to re-use the
install-debian.sh script directly.

> > * Cleanup some dependencies already available in the base image or
> >   uneeded: ca-certificates, curl, gnupg2, software-properties-common.
> > * Pass --no-install-recommends to apt-get.
> > * Pass -q=2 to reduce apt-get output noise.
> > * Install chromedriver 2.29 explicitely. We should install the
> >   chromedriver matching the browser used (chromium 57 in our case).
> >
> > Signed-off-by: Fathi Boudra <fathi.boudra at linaro.org>
> > ---
> >  Dockerfile.test | 50 ++++++++++++++++++-------------------------------
> >  1 file changed, 18 insertions(+), 32 deletions(-)
> >
> > diff --git a/Dockerfile.test b/Dockerfile.test
> > index 176d5af..b6c939e 100644
> > --- a/Dockerfile.test
> > +++ b/Dockerfile.test
> > @@ -4,43 +4,29 @@ FROM fuego
> >  # Install Fuego Release Test Dependencies
> >  # ==============================================================================
> >
> > -# Install Dependencies
> > -RUN apt-get update && \
> > -    apt-get -yV install \
> > +RUN apt-get update -q=2 ;\
> > +    # Install Dependencies
> > +    apt-get -q=2 -V --no-install-recommends install \
> >          apt-transport-https \
> > -        ca-certificates \
> >          chromium \
> > -        curl \
> > -        gnupg2 \
> >          imagemagick \
> >          python3 \
> >          python3-pip \
> > -        python3-pillow \
> > -        software-properties-common && \
> > -    rm -rf /var/lib/apt/lists/* && \
> > +        python3-pillow ;\
> > +    # Install Docker
> > +    curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - ;\
> > +    echo "deb https://download.docker.com/linux/debian jessie stable" > /etc/apt/sources.list.d/docker.list ;\
> > +    apt-get update -q=2 ;\
> > +    apt-get -q=2 -V --no-install-recommends install docker-ce ;\
> > +    # Install Python Dependencies from PyPI
> >      python3 -m pip install \
> >          docker \
> >          pexpect \
> > -        selenium
> > -
> > -# Install Docker
> > -RUN curl -fsSL https://download.docker.com/linux/$(source /etc/os-release; \
> > -        echo "$ID")/gpg | sudo apt-key add - && \
> > -    add-apt-repository \
> > -        "deb [arch=amd64] https://download.docker.com/linux/$(\
> > -            source /etc/os-release; echo "$ID") $(lsb_release -cs) stable" && \
> > -    apt-get update && \
> > -    apt-get -yV install \
> > -        docker-ce
> > -
> > -# Install Chrome Driver for SeleniumHQ
> > -RUN CHROME_DRIVER_VERSION=$(curl --silent --fail \
> > -        https://chromedriver.storage.googleapis.com/LATEST_RELEASE) && \
> > -    curl https://chromedriver.storage.googleapis.com/$(\
> > -        echo ${CHROME_DRIVER_VERSION})/chromedriver_linux64.zip \
> > -            -o chrome-driver.zip && \
> > -    unzip chrome-driver.zip -d /usr/local/bin && rm chrome-driver.zip && \
> > -    chmod +x /usr/local/bin/chromedriver
> > -
> > -# Setting jenkins as a sudoer. Needed for accessing the dockerd socket.
> > -RUN echo "jenkins ALL = (root) NOPASSWD:ALL" >> /etc/sudoers
> > +        selenium ;\
> > +    # Install Chrome Driver for SeleniumHQ
> > +    curl https://chromedriver.storage.googleapis.com/2.29/chromedriver_linux64.zip -o chrome-driver.zip ;\
> > +    unzip chrome-driver.zip -d /usr/local/bin ;\
> > +    chmod +x /usr/local/bin/chromedriver ;\
> > +    rm -rf /var/lib/apt/lists/* chrome-driver.zip ;\
> > +    # Setting jenkins as a sudoer. Needed for accessing the dockerd socket.
> > +    echo "jenkins ALL = (root) NOPASSWD:ALL" >> /etc/sudoers
> > --
> > 2.20.1
> >
> > _______________________________________________
> > Fuego mailing list
> > Fuego at lists.linuxfoundation.org
> > https://lists.linuxfoundation.org/mailman/listinfo/fuego
>
> --
> Linaro - Kernel Validation

Cheers,
Fathi


More information about the Fuego mailing list