Re: [igt-dev] [PATCH i-g-t 1/8] Dockerfile: Avoid messing with WORKDIR

Arkadiusz Hiler
2019-09-03T11:06:46Z

On Tue, Sep 03, 2019 at 12:35:10PM +0300, Petri Latvala wrote:
> On Tue, Sep 03, 2019 at 11:36:07AM +0300, Arkadiusz Hiler wrote:
> > Just to reset it soon after. Let's just `cd` for each command.
> >
> > Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> > ---
> > Dockerfile.build-fedora | 14 +++++---------
> > 1 file changed, 5 insertions(+), 9 deletions(-)
> >
> > diff --git a/Dockerfile.build-fedora b/Dockerfile.build-fedora
> > index 4ccaadd1..31056a2a 100644
> > --- a/Dockerfile.build-fedora
> > +++ b/Dockerfile.build-fedora
> > @@ -27,11 +27,11 @@ RUN dnf install -y \
> > # We need peg to build overlay
> > RUN dnf install -y make
> > RUN mkdir /tmp/peg
> > -WORKDIR /tmp/peg
> > +
> > # originaly from http://piumarta.com/software/peg/
> > -RUN curl -O https://intel-gfx-ci.01.org/mirror/peg/peg-0.1.18.tar.gz
> > -RUN tar xf peg-0.1.18.tar.gz
> > -RUN cd peg-0.1.18 && make PREFIX=/usr install
> > +RUN cd /tmp/peg && curl -O https://intel-gfx-ci.01.org/mirror/peg/peg-0.1.18.tar.gz
> > +RUN tar -C /tmp/peg -xf /tmp/peg/peg-0.1.18.tar.gz
> > +RUN cd /tmp/peg/peg-0.1.18 && make PREFIX=/usr install
>
> make -C /tmp/peg/peg-0.1.18 PREFIX=/usr install
>
> > RUN rm -fr /tmp/peg
> >
> > # For compile-testing on clang
> > @@ -41,8 +41,4 @@ RUN dnf install -y clang
> > RUN dnf install -y findutils
> >
> > # Meson version switching shenanigans
> > -WORKDIR /usr/src
> > -RUN curl -O https://files.pythonhosted.org/packages/c0/9b/44cdb8adcbb186be6cba5c93718d0c68f177b0e8082ae00cafa63a1d3535/meson-0.47.0.tar.gz
> > -
> > -# Cleanup workdir
> > -WORKDIR /
> > +RUN cd /usr/src && curl -O https://files.pythonhosted.org/packages/c0/9b/44cdb8adcbb186be6cba5c93718d0c68f177b0e8082ae00cafa63a1d3535/meson-0.47.0.tar.gz
>
> Removing the useless-use-of-cd in this curl invocation:
>
> curl -o "/usr/src/#1" "https://files.pythonhosted.org/packages/c0/9b/44cdb8adcbb186be6cba5c93718d0c68f177b0e8082ae00cafa63a1d3535/{meson-0.47.0.tar.gz}"
>
>
> Similar trick can be applied to the above curl line.

I am not sure that this curl invocation is that much better than a
simple `cd`, but ok:

https://gitlab.freedesktop.org/ivyl/igt/commit/e31bd8a518458a15c121a33bd7c72ef0b09e5251

And here's the pipeline:
https://gitlab.freedesktop.org/ivyl/igt/pipelines/60764

To save some real-hardware CI time I'll just keep the updates on gitlab,
it does not affect anything else anyway.

--
Cheers,
Arek