Message ID | 20230315062936.1101744-4-amusil@redhat.com |
---|---|
State | Accepted |
Headers | show |
Series | Use containers on CI | expand |
On 3/15/23 07:29, Ales Musil wrote: > In order to build the container from different > working directory we need to properly specify the path > to py-requirements.txt. Add ARG into the Dockerfile > and into Makefile which allows us to specify the path. > > Signed-off-by: Ales Musil <amusil@redhat.com> > --- > build-aux/initial-tab-whitelist | 1 + > utilities/containers/Makefile | 5 ++++- > utilities/containers/fedora/Dockerfile | 4 +++- > 3 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/build-aux/initial-tab-whitelist b/build-aux/initial-tab-whitelist > index b2f5a0791..8ad43d616 100644 > --- a/build-aux/initial-tab-whitelist > +++ b/build-aux/initial-tab-whitelist > @@ -9,3 +9,4 @@ > ^debian/rules.modules$ > ^debian/rules$ > ^\.gitmodules$ > +^utilities/containers/Makefile > diff --git a/utilities/containers/Makefile b/utilities/containers/Makefile > index 8b39e3493..ef1d42aca 100644 > --- a/utilities/containers/Makefile > +++ b/utilities/containers/Makefile > @@ -1,7 +1,10 @@ > CONTAINER_CMD ?= podman > DISTRO ?= fedora > IMAGE_NAME ?= "ovn-org/ovn-tests" > +CONTAINERS_PATH ?= "." > > .PHONY: build > > -build: ;$(CONTAINER_CMD) build --no-cache --rm -t $(IMAGE_NAME) -f $(DISTRO)/Dockerfile . > +build: > + $(CONTAINER_CMD) build --no-cache --rm -t $(IMAGE_NAME) \ > + -f $(DISTRO)/Dockerfile . --build-arg=CONTAINERS_PATH=$(CONTAINERS_PATH) > diff --git a/utilities/containers/fedora/Dockerfile b/utilities/containers/fedora/Dockerfile > index 4212e2d76..4058d7f5b 100755 > --- a/utilities/containers/fedora/Dockerfile > +++ b/utilities/containers/fedora/Dockerfile > @@ -1,5 +1,7 @@ > FROM quay.io/fedora/fedora:latest > > +ARG CONTAINERS_PATH > + > # Update distro, install packages and clean any possible leftovers > RUN dnf -y update \ > && \ > @@ -52,7 +54,7 @@ RUN git clone git://git.kernel.org/pub/scm/devel/sparse/sparse.git \ > > WORKDIR /workspace > > -COPY py-requirements.txt /tmp/py-requirements.txt > +COPY $CONTAINERS_PATH/py-requirements.txt /tmp/py-requirements.txt > > # Update and install pip dependencies > RUN python3 -m pip install --upgrade pip \ Depending on the direction we choose for patch 1/9 this one might also need changes. In any case, in the current form: Acked-by: Dumitru Ceara <dceara@redhat.com>
diff --git a/build-aux/initial-tab-whitelist b/build-aux/initial-tab-whitelist index b2f5a0791..8ad43d616 100644 --- a/build-aux/initial-tab-whitelist +++ b/build-aux/initial-tab-whitelist @@ -9,3 +9,4 @@ ^debian/rules.modules$ ^debian/rules$ ^\.gitmodules$ +^utilities/containers/Makefile diff --git a/utilities/containers/Makefile b/utilities/containers/Makefile index 8b39e3493..ef1d42aca 100644 --- a/utilities/containers/Makefile +++ b/utilities/containers/Makefile @@ -1,7 +1,10 @@ CONTAINER_CMD ?= podman DISTRO ?= fedora IMAGE_NAME ?= "ovn-org/ovn-tests" +CONTAINERS_PATH ?= "." .PHONY: build -build: ;$(CONTAINER_CMD) build --no-cache --rm -t $(IMAGE_NAME) -f $(DISTRO)/Dockerfile . +build: + $(CONTAINER_CMD) build --no-cache --rm -t $(IMAGE_NAME) \ + -f $(DISTRO)/Dockerfile . --build-arg=CONTAINERS_PATH=$(CONTAINERS_PATH) diff --git a/utilities/containers/fedora/Dockerfile b/utilities/containers/fedora/Dockerfile index 4212e2d76..4058d7f5b 100755 --- a/utilities/containers/fedora/Dockerfile +++ b/utilities/containers/fedora/Dockerfile @@ -1,5 +1,7 @@ FROM quay.io/fedora/fedora:latest +ARG CONTAINERS_PATH + # Update distro, install packages and clean any possible leftovers RUN dnf -y update \ && \ @@ -52,7 +54,7 @@ RUN git clone git://git.kernel.org/pub/scm/devel/sparse/sparse.git \ WORKDIR /workspace -COPY py-requirements.txt /tmp/py-requirements.txt +COPY $CONTAINERS_PATH/py-requirements.txt /tmp/py-requirements.txt # Update and install pip dependencies RUN python3 -m pip install --upgrade pip \
In order to build the container from different working directory we need to properly specify the path to py-requirements.txt. Add ARG into the Dockerfile and into Makefile which allows us to specify the path. Signed-off-by: Ales Musil <amusil@redhat.com> --- build-aux/initial-tab-whitelist | 1 + utilities/containers/Makefile | 5 ++++- utilities/containers/fedora/Dockerfile | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-)