[PATCH v1] dts: fix runner target in the Dockerfile

Juraj Linkeš juraj.linkes at pantheon.tech
Mon Sep 16 12:16:21 CEST 2024



On 11. 9. 2024 17:50, jspewock at iol.unh.edu wrote:
> From: Jeremy Spewock <jspewock at iol.unh.edu>
> 
> Currently the runner target in the Dockerfile attempts to run the
> `poetry install` command when building the image, but this fails due to
> poetry not being found in the container. Poetry is installed in a
> previous step with pipx, but doing so adds the binary to use poetry to
> ~/.local/bin which isn't present in the PATH variable in the container
> image. The command `pipx ensurepath` fixes this issue in most cases, but
> it requires a restart of the shell in order for the changes to take
> place which is not something that is done in the runner target. To
> solve this problem this patch manually adds ~/.local/bin to PATH in the
> runner target.
> 
> Additionally, the command for installing poetry in the runner target
> uses the depreciated flag --no-dev which is removed in this patch and
> replaced with the new method of doing the same thing alongside the
> --no-root flag from the DTS documentation.
> 
> Fixes: 19082c1fac43 ("dts: add Dockerfile")
> Cc: juraj.linkes at pantheon.tech
> 
> Signed-off-by: Jeremy Spewock <jspewock at iol.unh.edu>
> ---
>   dts/Dockerfile | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/dts/Dockerfile b/dts/Dockerfile
> index a81e46c41a..66b3cfd97f 100644
> --- a/dts/Dockerfile
> +++ b/dts/Dockerfile
> @@ -24,7 +24,10 @@ FROM base AS runner
>   # It bakes DTS into the image during the build.
>   
>   COPY . /dpdk/dts
> -RUN poetry install --no-dev
> +# Adds ~/.local/bin to PATH so that packages installed with pipx are callable. `pipx ensurepath`
> +# fixes this issue, but requires the shell to be re-opened which isn't an option for this target.
> +ENV PATH="$PATH:/root/.local/bin"
> +RUN poetry install --only main --no-root

There's a patch from Dean that removed --no-root. I suggest waiting for 
Dean to submit v2, then you rebase on top of that and I'll merge both of 
these as we seem to have the tags.

>   
>   CMD ["poetry", "run", "python", "main.py"]
>   



More information about the dev mailing list