Skip to contentSkip to conversation

tools/containerfiles: fix docker warning

PATCH Applied Antonin Godard 2 participants 3 messages Feb 27 – Mar 2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/containerfiles: fix docker warning

The current Containerfiles produce the following warning with docker:

1 warning found (use docker --debug to expand):
- UndefinedVar: Usage of undefined variable '$PWD' (line 12)

Remove $PWD and set the WORKDIR so that our pip3_docs.sh script finds the virtual env.

---
 documentation/tools/containerfiles/Containerfile.apt    | 6 +++++-
 documentation/tools/containerfiles/Containerfile.dnf    | 6 +++++-
 documentation/tools/containerfiles/Containerfile.zypper | 6 +++++-
 3 files changed, 15 insertions(+), 3 deletions(-)
documentation/tools/containerfiles/Containerfile.apt +5 -1
index 7ee168be1..0f480a79f 100644
@@ -9,9 +9,13 @@ FROM $ARG_FROM
 # container, and it must match the pwd when pip3_docs.sh is run in a later
 # layer. This *must* be outside of any mount point otherwise it won't be
 # available within the container.
-ENV VIRTUAL_ENV=$PWD/yocto-docs-venv
+ENV VIRTUAL_ENV=/yocto-docs-venv
 ENV PATH="$VIRTUAL_ENV/bin:$PATH"
 
+# Set the WORKDIR to / so the pip3_docs.sh script will find our virtual env
+# when calling '. ./yocto-docs-venv/bin/activate'.
+WORKDIR /
+
 ARG INCLUDE_ESSENTIAL_PACKAGES=0
 ARG ESSENTIAL=ubuntu_essential.sh
 ARG DOCS=ubuntu_docs.sh
documentation/tools/containerfiles/Containerfile.dnf +5 -1
index 12d97ef6c..d93ac7e65 100644
@@ -9,9 +9,13 @@ FROM $ARG_FROM
 # container, and it must match the pwd when pip3_docs.sh is run in a later
 # layer. This *must* be outside of any mount point otherwise it won't be
 # available within the container.
-ENV VIRTUAL_ENV=$PWD/yocto-docs-venv
+ENV VIRTUAL_ENV=/yocto-docs-venv
 ENV PATH="$VIRTUAL_ENV/bin:$PATH"
 
+# Set the WORKDIR to / so the pip3_docs.sh script will find our virtual env
+# when calling '. ./yocto-docs-venv/bin/activate'.
+WORKDIR /
+
 ARG INCLUDE_ESSENTIAL_PACKAGES=0
 ARG ESSENTIAL=fedora_essential.sh
 ARG DOCS=fedora_docs.sh
documentation/tools/containerfiles/Containerfile.zypper +5 -1
index 6e667967c..2e49311b0 100644
@@ -9,9 +9,13 @@ FROM $ARG_FROM
 # container, and it must match the pwd when pip3_docs.sh is run in a later
 # layer. This *must* be outside of any mount point otherwise it won't be
 # available within the container.
-ENV VIRTUAL_ENV=$PWD/yocto-docs-venv
+ENV VIRTUAL_ENV=/yocto-docs-venv
 ENV PATH="$VIRTUAL_ENV/bin:$PATH"
 
+# Set the WORKDIR to / so the pip3_docs.sh script will find our virtual env
+# when calling '. ./yocto-docs-venv/bin/activate'.
+WORKDIR /
+
 ARG INCLUDE_ESSENTIAL_PACKAGES=0
 ARG ESSENTIAL=opensuse_essential.sh
 ARG DOCS=opensuse_docs.sh

---
base-commit: ba351b35480d9c06c870a6f34d8bdbc1856b9511
change-id: 20260227-fix-docker-build-warning-812177bd3302

Reviewed-by on v1 1/1
#1 lore raw

Hi Antonin,

Quoted 8 lines · Antonin Godard

The current Containerfiles produce the following warning with docker:

1 warning found (use docker --debug to expand):
- UndefinedVar: Usage of undefined variable '$PWD' (line 12)

Remove $PWD and set the WORKDIR so that our pip3_docs.sh script finds the virtual env.

Thanks!
Quentin