diff mbox series

tools/containerfiles: fix docker warning

Message ID 20260227-fix-docker-build-warning-v1-1-5557689ebc3e@bootlin.com
State Under Review
Headers show
Series tools/containerfiles: fix docker warning | expand

Commit Message

Antonin Godard Feb. 27, 2026, 8:55 a.m. UTC
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.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 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(-)


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

Comments

Quentin Schulz Feb. 27, 2026, 9:52 a.m. UTC | #1
Hi Antonin,

On 2/27/26 9:55 AM, Antonin Godard wrote:
> 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.
> 

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>

Thanks!
Quentin
diff mbox series

Patch

diff --git a/documentation/tools/containerfiles/Containerfile.apt b/documentation/tools/containerfiles/Containerfile.apt
index 7ee168be1..0f480a79f 100644
--- a/documentation/tools/containerfiles/Containerfile.apt
+++ b/documentation/tools/containerfiles/Containerfile.apt
@@ -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
diff --git a/documentation/tools/containerfiles/Containerfile.dnf b/documentation/tools/containerfiles/Containerfile.dnf
index 12d97ef6c..d93ac7e65 100644
--- a/documentation/tools/containerfiles/Containerfile.dnf
+++ b/documentation/tools/containerfiles/Containerfile.dnf
@@ -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
diff --git a/documentation/tools/containerfiles/Containerfile.zypper b/documentation/tools/containerfiles/Containerfile.zypper
index 6e667967c..2e49311b0 100644
--- a/documentation/tools/containerfiles/Containerfile.zypper
+++ b/documentation/tools/containerfiles/Containerfile.zypper
@@ -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