[v1] dts: add Dockerfile

Message ID 20221103134633.446646-1-juraj.linkes@pantheon.tech (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers
Series [v1] dts: add Dockerfile |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Juraj Linkeš Nov. 3, 2022, 1:46 p.m. UTC
  The Dockerfile defines development and CI runner images.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 dts/.devcontainer/devcontainer.json | 30 ++++++++++++++++
 dts/Dockerfile                      | 38 ++++++++++++++++++++
 dts/README.md                       | 55 +++++++++++++++++++++++++++++
 3 files changed, 123 insertions(+)
 create mode 100644 dts/.devcontainer/devcontainer.json
 create mode 100644 dts/Dockerfile
 create mode 100644 dts/README.md
  

Comments

Juraj Linkeš Nov. 4, 2022, 9:16 a.m. UTC | #1
Adding folks I forgot to add.

> -----Original Message-----
> From: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Sent: Thursday, November 3, 2022 2:47 PM
> Cc: dev@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech>
> Subject: [PATCH v1] dts: add Dockerfile
> 
> The Dockerfile defines development and CI runner images.
> 
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> ---
>  dts/.devcontainer/devcontainer.json | 30 ++++++++++++++++
>  dts/Dockerfile                      | 38 ++++++++++++++++++++
>  dts/README.md                       | 55 +++++++++++++++++++++++++++++
>  3 files changed, 123 insertions(+)
>  create mode 100644 dts/.devcontainer/devcontainer.json
>  create mode 100644 dts/Dockerfile
>  create mode 100644 dts/README.md
> 
> diff --git a/dts/.devcontainer/devcontainer.json
> b/dts/.devcontainer/devcontainer.json
> new file mode 100644
> index 0000000000..41ca28fc17
> --- /dev/null
> +++ b/dts/.devcontainer/devcontainer.json
> @@ -0,0 +1,30 @@
> +// For format details, see https://aka.ms/devcontainer.json. For config
> options, see the README at:
> +//
> +https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/contai
> +ners/docker-existing-dockerfile
> +{
> +	"name": "Existing Dockerfile",
> +
> +	// Sets the run context to one level up instead of the .devcontainer
> folder.
> +	"context": "..",
> +
> +	// Update the 'dockerFile' property if you aren't using the standard
> 'Dockerfile' filename.
> +	"dockerFile": "../Dockerfile",
> +
> +	// Use 'forwardPorts' to make a list of ports inside the container
> available locally.
> +	// "forwardPorts": [],
> +
> +	// Uncomment the next line to run commands after the container is
> created - for example installing curl.
> +	"postCreateCommand": "poetry install",
> +
> +	"extensions": [
> +		"ms-python.vscode-pylance",
> +	]
> +
> +	// Uncomment when using a ptrace-based debugger like C++, Go,
> and Rust
> +	// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt",
> +"seccomp=unconfined" ],
> +
> +	// Uncomment to use the Docker CLI from inside the container. See
> https://aka.ms/vscode-remote/samples/docker-from-docker.
> +	// "mounts": [
> +"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
> +
> +	// Uncomment to connect as a non-root user if you've added one.
> See https://aka.ms/vscode-remote/containers/non-root.
> +	// "remoteUser": "vscode"
> +}
> diff --git a/dts/Dockerfile b/dts/Dockerfile new file mode 100644 index
> 0000000000..9a91949eeb
> --- /dev/null
> +++ b/dts/Dockerfile
> @@ -0,0 +1,38 @@
> +# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2022 University
> +of New Hampshire
> +
> +# There are two Docker images defined in this Dockerfile.
> +# One is to be used in CI for automated testing.
> +# The other provides a DTS development environment, simplifying Python
> dependency management.
> +
> +FROM ubuntu:22.04 AS base
> +
> +RUN apt-get -y update && apt-get -y upgrade && \
> +    apt-get -y install --no-install-recommends \
> +        python3 \
> +        python3-pip \
> +        python3-pexpect \
> +        python3-poetry \
> +        python3-cachecontrol \
> +        openssh-client
> +WORKDIR /dpdk/dts
> +
> +
> +FROM base AS runner
> +
> +# This image is intended to be used as the base for automated systems.
> +# It bakes DTS into the image during the build.
> +
> +COPY . /dpdk/dts
> +RUN poetry install --no-dev
> +
> +CMD ["poetry", "run", "python", "main.py"]
> +
> +FROM base AS dev
> +
> +# This image is intended to be used as DTS development environment. It
> +doesn't need C compilation # capabilities, only Python dependencies.
> +Once a container mounting DTS using this image is running, # the
> dependencies should be installed using Poetry.
> +
> +RUN apt-get -y install --no-install-recommends \
> +        vim emacs git
> diff --git a/dts/README.md b/dts/README.md new file mode 100644 index
> 0000000000..fd9f32595c
> --- /dev/null
> +++ b/dts/README.md
> @@ -0,0 +1,55 @@
> +# DTS Environment
> +The execution and development environments for DTS are the same, a
> +[Docker](https://docs.docker.com/) container defined by our
> [Dockerfile](./Dockerfile).
> +Using a container for the development environment helps with a few
> things.
> +
> +1. It helps enforce the boundary between the DTS environment and the
> TG/SUT, something
> +   which caused issues in the past.
> +2. It makes creating containers to run DTS inside automated tooling much
> easier, since
> +   they can be based off of a known-working environment that will be
> updated as DTS is.
> +3. It abstracts DTS from the server it is running on. This means that the bare-
> metal os
> +   can be whatever corporate policy or your personal preferences dictate,
> and DTS does
> +   not have to try to support all distros that are supported by DPDK CI.
> +4. It makes automated testing for DTS easier, since new dependencies
> +can be sent in with
> +  the patches.
> +5. It fixes the issue of undocumented dependencies, where some test
> suites require
> +   python libraries that are not installed.
> +6. Allows everyone to use the same python version easily, even if they are
> using a
> +   distribution or Windows with out-of-date packages.
> +7. Allows you to run the tester on Windows while developing via Docker for
> Windows.
> +
> +## Tips for setting up a development environment
> +
> +### Getting a docker shell
> +These commands will give you a bash shell inside the container with all
> +the python dependencies installed. This will place you inside a python
> +virtual environment. DTS is mounted via a volume, which is essentially a
> symlink from the host to the container.
> +This enables you to edit and run inside the container and then delete
> +the container when you are done, keeping your work.
> +
> +```shell
> +docker build --target dev -t dpdk-dts .
> +docker run -v $(pwd)/..:/dpdk -it dpdk-dts bash $ poetry install $
> +poetry shell ```
> +
> +### Vim/Emacs
> +Any editor in the ubuntu repos should be easy to use, with vim and
> +emacs already installed. You can add your normal config files as a
> +volume, enabling you to use your preferred settings.
> +
> +```shell
> +docker run -v ${HOME}/.vimrc:/root/.vimrc -v $(pwd)/..:/dpdk -it
> +dpdk-dts bash ```
> +
> +### Visual Studio Code
> +VSCode has first-class support for developing with containers. You may
> +need to run the non-docker setup commands in the integrated terminal.
> +DTS contains a .devcontainer config, so if you open the folder in
> +vscode it should prompt you to use the dev container assuming you have
> +the plugin installed. Please refer to [VS Development Containers
> +Docs](https://code.visualstudio.com/docs/remote/containers)
> +to set it all up.
> +
> +### Other
> +Searching for '$IDE dev containers' will probably lead you in the right
> direction.
> --
> 2.30.2
  
Patrick Robb Feb. 9, 2023, 4:49 p.m. UTC | #2
On Fri, Nov 4, 2022 at 5:16 AM Juraj Linkeš <juraj.linkes@pantheon.tech>
wrote:

> Adding folks I forgot to add.
>
> > -----Original Message-----
> > From: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > Sent: Thursday, November 3, 2022 2:47 PM
> > Cc: dev@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech>
> > Subject: [PATCH v1] dts: add Dockerfile
> >
> > The Dockerfile defines development and CI runner images.
> >
> > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > ---
> >  dts/.devcontainer/devcontainer.json | 30 ++++++++++++++++
> >  dts/Dockerfile                      | 38 ++++++++++++++++++++
> >  dts/README.md                       | 55 +++++++++++++++++++++++++++++
> >  3 files changed, 123 insertions(+)
> >  create mode 100644 dts/.devcontainer/devcontainer.json
> >  create mode 100644 dts/Dockerfile
> >  create mode 100644 dts/README.md
> >
> > diff --git a/dts/.devcontainer/devcontainer.json
> > b/dts/.devcontainer/devcontainer.json
> > new file mode 100644
> > index 0000000000..41ca28fc17
> > --- /dev/null
> > +++ b/dts/.devcontainer/devcontainer.json
> > @@ -0,0 +1,30 @@
> > +// For format details, see https://aka.ms/devcontainer.json. For config
> > options, see the README at:
> > +//
> > +https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/contai
> > +ners/docker-existing-dockerfile
> > +{
> > +     "name": "Existing Dockerfile",
> > +
> > +     // Sets the run context to one level up instead of the
> .devcontainer
> > folder.
> > +     "context": "..",
> > +
> > +     // Update the 'dockerFile' property if you aren't using the
> standard
> > 'Dockerfile' filename.
> > +     "dockerFile": "../Dockerfile",
> > +
> > +     // Use 'forwardPorts' to make a list of ports inside the container
> > available locally.
> > +     // "forwardPorts": [],
> > +
> > +     // Uncomment the next line to run commands after the container is
> > created - for example installing curl.
> > +     "postCreateCommand": "poetry install",
> > +
> > +     "extensions": [
> > +             "ms-python.vscode-pylance",
> > +     ]
> > +
> > +     // Uncomment when using a ptrace-based debugger like C++, Go,
> > and Rust
> > +     // "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt",
> > +"seccomp=unconfined" ],
> > +
> > +     // Uncomment to use the Docker CLI from inside the container. See
> > https://aka.ms/vscode-remote/samples/docker-from-docker.
> > +     // "mounts": [
> > +"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
> > +
> > +     // Uncomment to connect as a non-root user if you've added one.
> > See https://aka.ms/vscode-remote/containers/non-root.
> > +     // "remoteUser": "vscode"
> > +}
> > diff --git a/dts/Dockerfile b/dts/Dockerfile new file mode 100644 index
> > 0000000000..9a91949eeb
> > --- /dev/null
> > +++ b/dts/Dockerfile
> > @@ -0,0 +1,38 @@
> > +# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2022 University
> > +of New Hampshire
> > +
> > +# There are two Docker images defined in this Dockerfile.
> > +# One is to be used in CI for automated testing.
> > +# The other provides a DTS development environment, simplifying Python
> > dependency management.
> > +
> > +FROM ubuntu:22.04 AS base
> > +
> > +RUN apt-get -y update && apt-get -y upgrade && \
> > +    apt-get -y install --no-install-recommends \
> > +        python3 \
> > +        python3-pip \
> > +        python3-pexpect \
> > +        python3-poetry \
> > +        python3-cachecontrol \
> > +        openssh-client
> > +WORKDIR /dpdk/dts
> > +
> > +
> > +FROM base AS runner
> > +
> > +# This image is intended to be used as the base for automated systems.
> > +# It bakes DTS into the image during the build.
> > +
> > +COPY . /dpdk/dts
> > +RUN poetry install --no-dev
> > +
> > +CMD ["poetry", "run", "python", "main.py"]
> > +
> > +FROM base AS dev
> > +
> > +# This image is intended to be used as DTS development environment. It
> > +doesn't need C compilation # capabilities, only Python dependencies.
> > +Once a container mounting DTS using this image is running, # the
> > dependencies should be installed using Poetry.
> > +
> > +RUN apt-get -y install --no-install-recommends \
> > +        vim emacs git
> > diff --git a/dts/README.md b/dts/README.md new file mode 100644 index
> > 0000000000..fd9f32595c
> > --- /dev/null
> > +++ b/dts/README.md
> > @@ -0,0 +1,55 @@
> > +# DTS Environment
> > +The execution and development environments for DTS are the same, a
> > +[Docker](https://docs.docker.com/) container defined by our
> > [Dockerfile](./Dockerfile).
> > +Using a container for the development environment helps with a few
> > things.
> > +
> > +1. It helps enforce the boundary between the DTS environment and the
> > TG/SUT, something
> > +   which caused issues in the past.
> > +2. It makes creating containers to run DTS inside automated tooling much
> > easier, since
> > +   they can be based off of a known-working environment that will be
> > updated as DTS is.
> > +3. It abstracts DTS from the server it is running on. This means that
> the bare-
> > metal os
> > +   can be whatever corporate policy or your personal preferences
> dictate,
> > and DTS does
> > +   not have to try to support all distros that are supported by DPDK CI.
> > +4. It makes automated testing for DTS easier, since new dependencies
> > +can be sent in with
> > +  the patches.
> > +5. It fixes the issue of undocumented dependencies, where some test
> > suites require
> > +   python libraries that are not installed.
> > +6. Allows everyone to use the same python version easily, even if they
> are
> > using a
> > +   distribution or Windows with out-of-date packages.
> > +7. Allows you to run the tester on Windows while developing via Docker
> for
> > Windows.
> > +
> > +## Tips for setting up a development environment
> > +
> > +### Getting a docker shell
> > +These commands will give you a bash shell inside the container with all
> > +the python dependencies installed. This will place you inside a python
> > +virtual environment. DTS is mounted via a volume, which is essentially a
> > symlink from the host to the container.
> > +This enables you to edit and run inside the container and then delete
> > +the container when you are done, keeping your work.
> > +
> > +```shell
> > +docker build --target dev -t dpdk-dts .
> > +docker run -v $(pwd)/..:/dpdk -it dpdk-dts bash $ poetry install $
> > +poetry shell ```
> > +
> > +### Vim/Emacs
> > +Any editor in the ubuntu repos should be easy to use, with vim and
> > +emacs already installed. You can add your normal config files as a
> > +volume, enabling you to use your preferred settings.
> > +
> > +```shell
> > +docker run -v ${HOME}/.vimrc:/root/.vimrc -v $(pwd)/..:/dpdk -it
> > +dpdk-dts bash ```
> > +
> > +### Visual Studio Code
> > +VSCode has first-class support for developing with containers. You may
> > +need to run the non-docker setup commands in the integrated terminal.
> > +DTS contains a .devcontainer config, so if you open the folder in
> > +vscode it should prompt you to use the dev container assuming you have
> > +the plugin installed. Please refer to [VS Development Containers
> > +Docs](https://code.visualstudio.com/docs/remote/containers)
> > +to set it all up.
> > +
> > +### Other
> > +Searching for '$IDE dev containers' will probably lead you in the right
> > direction.
> > --
> > 2.30.2
>
> Tested-by: Patrick Robb <probb@iol.unh.edu>
  
Jeremy Spewock April 28, 2023, 7:34 p.m. UTC | #3
Acked-by: Jeremy Spweock <jspweock@iol.unh.edu>

On Thu, Feb 9, 2023 at 11:49 AM Patrick Robb <probb@iol.unh.edu> wrote:

>
>
> On Fri, Nov 4, 2022 at 5:16 AM Juraj Linkeš <juraj.linkes@pantheon.tech>
> wrote:
>
>> Adding folks I forgot to add.
>>
>> > -----Original Message-----
>> > From: Juraj Linkeš <juraj.linkes@pantheon.tech>
>> > Sent: Thursday, November 3, 2022 2:47 PM
>> > Cc: dev@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech>
>> > Subject: [PATCH v1] dts: add Dockerfile
>> >
>> > The Dockerfile defines development and CI runner images.
>> >
>> > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
>> > ---
>> >  dts/.devcontainer/devcontainer.json | 30 ++++++++++++++++
>> >  dts/Dockerfile                      | 38 ++++++++++++++++++++
>> >  dts/README.md                       | 55 +++++++++++++++++++++++++++++
>> >  3 files changed, 123 insertions(+)
>> >  create mode 100644 dts/.devcontainer/devcontainer.json
>> >  create mode 100644 dts/Dockerfile
>> >  create mode 100644 dts/README.md
>> >
>> > diff --git a/dts/.devcontainer/devcontainer.json
>> > b/dts/.devcontainer/devcontainer.json
>> > new file mode 100644
>> > index 0000000000..41ca28fc17
>> > --- /dev/null
>> > +++ b/dts/.devcontainer/devcontainer.json
>> > @@ -0,0 +1,30 @@
>> > +// For format details, see https://aka.ms/devcontainer.json. For
>> config
>> > options, see the README at:
>> > +//
>> > +
>> https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/contai
>> > +ners/docker-existing-dockerfile
>> > +{
>> > +     "name": "Existing Dockerfile",
>> > +
>> > +     // Sets the run context to one level up instead of the
>> .devcontainer
>> > folder.
>> > +     "context": "..",
>> > +
>> > +     // Update the 'dockerFile' property if you aren't using the
>> standard
>> > 'Dockerfile' filename.
>> > +     "dockerFile": "../Dockerfile",
>> > +
>> > +     // Use 'forwardPorts' to make a list of ports inside the container
>> > available locally.
>> > +     // "forwardPorts": [],
>> > +
>> > +     // Uncomment the next line to run commands after the container is
>> > created - for example installing curl.
>> > +     "postCreateCommand": "poetry install",
>> > +
>> > +     "extensions": [
>> > +             "ms-python.vscode-pylance",
>> > +     ]
>> > +
>> > +     // Uncomment when using a ptrace-based debugger like C++, Go,
>> > and Rust
>> > +     // "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt",
>> > +"seccomp=unconfined" ],
>> > +
>> > +     // Uncomment to use the Docker CLI from inside the container. See
>> > https://aka.ms/vscode-remote/samples/docker-from-docker.
>> > +     // "mounts": [
>> > +"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
>> > +
>> > +     // Uncomment to connect as a non-root user if you've added one.
>> > See https://aka.ms/vscode-remote/containers/non-root.
>> > +     // "remoteUser": "vscode"
>> > +}
>> > diff --git a/dts/Dockerfile b/dts/Dockerfile new file mode 100644 index
>> > 0000000000..9a91949eeb
>> > --- /dev/null
>> > +++ b/dts/Dockerfile
>> > @@ -0,0 +1,38 @@
>> > +# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2022 University
>> > +of New Hampshire
>> > +
>> > +# There are two Docker images defined in this Dockerfile.
>> > +# One is to be used in CI for automated testing.
>> > +# The other provides a DTS development environment, simplifying Python
>> > dependency management.
>> > +
>> > +FROM ubuntu:22.04 AS base
>> > +
>> > +RUN apt-get -y update && apt-get -y upgrade && \
>> > +    apt-get -y install --no-install-recommends \
>> > +        python3 \
>> > +        python3-pip \
>> > +        python3-pexpect \
>> > +        python3-poetry \
>> > +        python3-cachecontrol \
>> > +        openssh-client
>> > +WORKDIR /dpdk/dts
>> > +
>> > +
>> > +FROM base AS runner
>> > +
>> > +# This image is intended to be used as the base for automated systems.
>> > +# It bakes DTS into the image during the build.
>> > +
>> > +COPY . /dpdk/dts
>> > +RUN poetry install --no-dev
>> > +
>> > +CMD ["poetry", "run", "python", "main.py"]
>> > +
>> > +FROM base AS dev
>> > +
>> > +# This image is intended to be used as DTS development environment. It
>> > +doesn't need C compilation # capabilities, only Python dependencies.
>> > +Once a container mounting DTS using this image is running, # the
>> > dependencies should be installed using Poetry.
>> > +
>> > +RUN apt-get -y install --no-install-recommends \
>> > +        vim emacs git
>> > diff --git a/dts/README.md b/dts/README.md new file mode 100644 index
>> > 0000000000..fd9f32595c
>> > --- /dev/null
>> > +++ b/dts/README.md
>> > @@ -0,0 +1,55 @@
>> > +# DTS Environment
>> > +The execution and development environments for DTS are the same, a
>> > +[Docker](https://docs.docker.com/) container defined by our
>> > [Dockerfile](./Dockerfile).
>> > +Using a container for the development environment helps with a few
>> > things.
>> > +
>> > +1. It helps enforce the boundary between the DTS environment and the
>> > TG/SUT, something
>> > +   which caused issues in the past.
>> > +2. It makes creating containers to run DTS inside automated tooling
>> much
>> > easier, since
>> > +   they can be based off of a known-working environment that will be
>> > updated as DTS is.
>> > +3. It abstracts DTS from the server it is running on. This means that
>> the bare-
>> > metal os
>> > +   can be whatever corporate policy or your personal preferences
>> dictate,
>> > and DTS does
>> > +   not have to try to support all distros that are supported by DPDK
>> CI.
>> > +4. It makes automated testing for DTS easier, since new dependencies
>> > +can be sent in with
>> > +  the patches.
>> > +5. It fixes the issue of undocumented dependencies, where some test
>> > suites require
>> > +   python libraries that are not installed.
>> > +6. Allows everyone to use the same python version easily, even if they
>> are
>> > using a
>> > +   distribution or Windows with out-of-date packages.
>> > +7. Allows you to run the tester on Windows while developing via Docker
>> for
>> > Windows.
>> > +
>> > +## Tips for setting up a development environment
>> > +
>> > +### Getting a docker shell
>> > +These commands will give you a bash shell inside the container with all
>> > +the python dependencies installed. This will place you inside a python
>> > +virtual environment. DTS is mounted via a volume, which is essentially
>> a
>> > symlink from the host to the container.
>> > +This enables you to edit and run inside the container and then delete
>> > +the container when you are done, keeping your work.
>> > +
>> > +```shell
>> > +docker build --target dev -t dpdk-dts .
>> > +docker run -v $(pwd)/..:/dpdk -it dpdk-dts bash $ poetry install $
>> > +poetry shell ```
>> > +
>> > +### Vim/Emacs
>> > +Any editor in the ubuntu repos should be easy to use, with vim and
>> > +emacs already installed. You can add your normal config files as a
>> > +volume, enabling you to use your preferred settings.
>> > +
>> > +```shell
>> > +docker run -v ${HOME}/.vimrc:/root/.vimrc -v $(pwd)/..:/dpdk -it
>> > +dpdk-dts bash ```
>> > +
>> > +### Visual Studio Code
>> > +VSCode has first-class support for developing with containers. You may
>> > +need to run the non-docker setup commands in the integrated terminal.
>> > +DTS contains a .devcontainer config, so if you open the folder in
>> > +vscode it should prompt you to use the dev container assuming you have
>> > +the plugin installed. Please refer to [VS Development Containers
>> > +Docs](https://code.visualstudio.com/docs/remote/containers)
>> > +to set it all up.
>> > +
>> > +### Other
>> > +Searching for '$IDE dev containers' will probably lead you in the right
>> > direction.
>> > --
>> > 2.30.2
>>
>> Tested-by: Patrick Robb <probb@iol.unh.edu>
>
> --
>
> Patrick Robb
>
> Technical Service Manager
>
> UNH InterOperability Laboratory
>
> 21 Madbury Rd, Suite 100, Durham, NH 03824
>
> www.iol.unh.edu
>
>
>
  
Paul Szczepanek Oct. 17, 2023, 1:52 p.m. UTC | #4
On 03/11/2022 13:46, Juraj Linkeš wrote:
> The Dockerfile defines development and CI runner images.
>
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Acked-by: Jeremy Spweock <jspweock@iol.unh.edu>
> ---
>   dts/.devcontainer/devcontainer.json | 30 ++++++++++++++++
>   dts/Dockerfile                      | 38 ++++++++++++++++++++
>   dts/README.md                       | 55 +++++++++++++++++++++++++++++
>   3 files changed, 123 insertions(+)
>   create mode 100644 dts/.devcontainer/devcontainer.json
>   create mode 100644 dts/Dockerfile
>   create mode 100644 dts/README.md
[..]


Acked-by: Paul Szczepanek <paul.szczepanek@arm.com>
  
Jeremy Spewock Oct. 26, 2023, 9:56 p.m. UTC | #5
I recently ran into issues using the above Dockerfile because of the
version of poetry. I found that installing poetry with pip3 rather than apt
fixed my issue with it.

On Tue, Oct 17, 2023 at 9:52 AM Paul Szczepanek <paul.szczepanek@arm.com>
wrote:

>
> On 03/11/2022 13:46, Juraj Linkeš wrote:
> > The Dockerfile defines development and CI runner images.
> >
> > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > Acked-by: Jeremy Spweock <jspweock@iol.unh.edu>
> > ---
> >   dts/.devcontainer/devcontainer.json | 30 ++++++++++++++++
> >   dts/Dockerfile                      | 38 ++++++++++++++++++++
> >   dts/README.md                       | 55 +++++++++++++++++++++++++++++
> >   3 files changed, 123 insertions(+)
> >   create mode 100644 dts/.devcontainer/devcontainer.json
> >   create mode 100644 dts/Dockerfile
> >   create mode 100644 dts/README.md
> [..]
>
>
> Acked-by: Paul Szczepanek <paul.szczepanek@arm.com>
>
>
  
Juraj Linkeš Oct. 27, 2023, 9:19 a.m. UTC | #6
On Thu, Oct 26, 2023 at 11:56 PM Jeremy Spewock <jspewock@iol.unh.edu> wrote:
>
> I recently ran into issues using the above Dockerfile because of the version of poetry. I found that installing poetry with pip3 rather than apt fixed my issue with it.

This is what have in DTS docs in doc/guides/tools/dts.rst:
To install Poetry, visit their `doc pages <https://python-poetry.org/docs/>`_.
The recommended Poetry version is at least 1.5.1.

The Docker container may need to be updated to reflect this (or the
docs, but I feel what we have in docs is sufficient) - feel free to
submit a new version.

>
>
> On Tue, Oct 17, 2023 at 9:52 AM Paul Szczepanek <paul.szczepanek@arm.com> wrote:
>>
>>
>> On 03/11/2022 13:46, Juraj Linkeš wrote:
>> > The Dockerfile defines development and CI runner images.
>> >
>> > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
>> > Acked-by: Jeremy Spweock <jspweock@iol.unh.edu>
>> > ---
>> >   dts/.devcontainer/devcontainer.json | 30 ++++++++++++++++
>> >   dts/Dockerfile                      | 38 ++++++++++++++++++++
>> >   dts/README.md                       | 55 +++++++++++++++++++++++++++++
>> >   3 files changed, 123 insertions(+)
>> >   create mode 100644 dts/.devcontainer/devcontainer.json
>> >   create mode 100644 dts/Dockerfile
>> >   create mode 100644 dts/README.md
>> [..]
>>
>>
>> Acked-by: Paul Szczepanek <paul.szczepanek@arm.com>
>>
  

Patch

diff --git a/dts/.devcontainer/devcontainer.json b/dts/.devcontainer/devcontainer.json
new file mode 100644
index 0000000000..41ca28fc17
--- /dev/null
+++ b/dts/.devcontainer/devcontainer.json
@@ -0,0 +1,30 @@ 
+// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
+// https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/containers/docker-existing-dockerfile
+{
+	"name": "Existing Dockerfile",
+
+	// Sets the run context to one level up instead of the .devcontainer folder.
+	"context": "..",
+
+	// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
+	"dockerFile": "../Dockerfile",
+
+	// Use 'forwardPorts' to make a list of ports inside the container available locally.
+	// "forwardPorts": [],
+
+	// Uncomment the next line to run commands after the container is created - for example installing curl.
+	"postCreateCommand": "poetry install",
+
+	"extensions": [
+		"ms-python.vscode-pylance",
+	]
+
+	// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
+	// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
+
+	// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
+	// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
+
+	// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
+	// "remoteUser": "vscode"
+}
diff --git a/dts/Dockerfile b/dts/Dockerfile
new file mode 100644
index 0000000000..9a91949eeb
--- /dev/null
+++ b/dts/Dockerfile
@@ -0,0 +1,38 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 University of New Hampshire
+
+# There are two Docker images defined in this Dockerfile.
+# One is to be used in CI for automated testing.
+# The other provides a DTS development environment, simplifying Python dependency management.
+
+FROM ubuntu:22.04 AS base
+
+RUN apt-get -y update && apt-get -y upgrade && \
+    apt-get -y install --no-install-recommends \
+        python3 \
+        python3-pip \
+        python3-pexpect \
+        python3-poetry \
+        python3-cachecontrol \
+        openssh-client
+WORKDIR /dpdk/dts
+
+
+FROM base AS runner
+
+# This image is intended to be used as the base for automated systems.
+# It bakes DTS into the image during the build.
+
+COPY . /dpdk/dts
+RUN poetry install --no-dev
+
+CMD ["poetry", "run", "python", "main.py"]
+
+FROM base AS dev
+
+# This image is intended to be used as DTS development environment. It doesn't need C compilation
+# capabilities, only Python dependencies. Once a container mounting DTS using this image is running,
+# the dependencies should be installed using Poetry.
+
+RUN apt-get -y install --no-install-recommends \
+        vim emacs git
diff --git a/dts/README.md b/dts/README.md
new file mode 100644
index 0000000000..fd9f32595c
--- /dev/null
+++ b/dts/README.md
@@ -0,0 +1,55 @@ 
+# DTS Environment
+The execution and development environments for DTS are the same, a
+[Docker](https://docs.docker.com/) container defined by our [Dockerfile](./Dockerfile).
+Using a container for the development environment helps with a few things.
+
+1. It helps enforce the boundary between the DTS environment and the TG/SUT, something
+   which caused issues in the past.
+2. It makes creating containers to run DTS inside automated tooling much easier, since
+   they can be based off of a known-working environment that will be updated as DTS is.
+3. It abstracts DTS from the server it is running on. This means that the bare-metal os
+   can be whatever corporate policy or your personal preferences dictate, and DTS does
+   not have to try to support all distros that are supported by DPDK CI.
+4. It makes automated testing for DTS easier, since new dependencies can be sent in with
+  the patches.
+5. It fixes the issue of undocumented dependencies, where some test suites require
+   python libraries that are not installed.
+6. Allows everyone to use the same python version easily, even if they are using a
+   distribution or Windows with out-of-date packages.
+7. Allows you to run the tester on Windows while developing via Docker for Windows.
+
+## Tips for setting up a development environment
+
+### Getting a docker shell
+These commands will give you a bash shell inside the container with all the python
+dependencies installed. This will place you inside a python virtual environment. DTS is
+mounted via a volume, which is essentially a symlink from the host to the container.
+This enables you to edit and run inside the container and then delete the container when
+you are done, keeping your work.
+
+```shell
+docker build --target dev -t dpdk-dts .
+docker run -v $(pwd)/..:/dpdk -it dpdk-dts bash
+$ poetry install
+$ poetry shell
+```
+
+### Vim/Emacs
+Any editor in the ubuntu repos should be easy to use, with vim and emacs already
+installed. You can add your normal config files as a volume, enabling you to use your
+preferred settings.
+
+```shell
+docker run -v ${HOME}/.vimrc:/root/.vimrc -v $(pwd)/..:/dpdk -it dpdk-dts bash
+```
+
+### Visual Studio Code
+VSCode has first-class support for developing with containers. You may need to run the
+non-docker setup commands in the integrated terminal. DTS contains a .devcontainer
+config, so if you open the folder in vscode it should prompt you to use the dev
+container assuming you have the plugin installed. Please refer to
+[VS Development Containers Docs](https://code.visualstudio.com/docs/remote/containers)
+to set it all up.
+
+### Other
+Searching for '$IDE dev containers' will probably lead you in the right direction.