Skip to contentSkip to conversation

dts: add Dockerfile

PATCH In review Juraj Linkeš 6 participants 17 messages Nov 3, 2022 – Mar 7, 2024 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dts: add Dockerfile

The Dockerfile defines development and CI runner images.

---
 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
dts/.devcontainer/devcontainer.json new file +30 -0
new file mode 100644
index 0000000000..41ca28fc17
@@ -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"
+}
dts/Dockerfile new file +38 -0
new file mode 100644
index 0000000000..9a91949eeb
@@ -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
dts/README.md new file +55 -0

55 lines not on this page · raw message

Signature · 1 line
2.30.2
#1 lore raw

Adding folks I forgot to add.

Quoted 186 lines

-----Original Message-----
From: Juraj Linkeš <[email protected]>
Sent: Thursday, November 3, 2022 2:47 PM
Cc: [email protected]; Juraj Linkeš <[email protected]>
Subject: [PATCH v1] dts: add Dockerfile

The Dockerfile defines development and CI runner images.

---
 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
dts/.devcontainer/devcontainer.json new file +1 -0
new file mode 100644
index 0000000000..41ca28fc17
@@ -0,0 +1,30 @@
+// For format details, see https://aka.ms/devcontainer.json. For config

options, see the README at:

dts/.devcontainer/devcontainer.json new file +7 -0
+//
+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.

dts/.devcontainer/devcontainer.json new file +3 -0
+	"context": "..",
+
+	// Update the 'dockerFile' property if you aren't using the standard

'Dockerfile' filename.

dts/.devcontainer/devcontainer.json new file +3 -0
+	"dockerFile": "../Dockerfile",
+
+	// Use 'forwardPorts' to make a list of ports inside the container

available locally.

dts/.devcontainer/devcontainer.json new file +3 -0
+	// "forwardPorts": [],
+
+	// Uncomment the next line to run commands after the container is

created - for example installing curl.

dts/.devcontainer/devcontainer.json new file +7 -0
+	"postCreateCommand": "poetry install",
+
+	"extensions": [
+		"ms-python.vscode-pylance",
+	]
+
+	// Uncomment when using a ptrace-based debugger like C++, Go,

and Rust

dts/.devcontainer/devcontainer.json new file +4 -0
+	// "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.

dts/.devcontainer/devcontainer.json new file +4 -0
+	// "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.

dts/.devcontainer/devcontainer.json new file +2 -0
+	// "remoteUser": "vscode"
+}
dts/Dockerfile new file mode 100644 index renamed from dts/Dockerfile +0 -0

0000000000..9a91949eeb

dts/Dockerfile new file +6 -0
@@ -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.

dts/Dockerfile new file +29 -0
+
+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.

dts/Dockerfile new file +3 -0
+
+RUN apt-get -y install --no-install-recommends \
+        vim emacs git
dts/README.md new file mode 100644 index renamed from dts/README.md +0 -0

0000000000..fd9f32595c

dts/README.md new file +3 -0
@@ -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

dts/README.md new file +5 -0
+   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.

dts/README.md new file +7 -0
+
+## 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.

dts/README.md new file +28 -0
+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

#2 lore raw
Quoted 196 lines · Juraj Linkeš

Adding folks I forgot to add.

Quoted 27 lines

-----Original Message-----
From: Juraj Linkeš <[email protected]>
Sent: Thursday, November 3, 2022 2:47 PM
Cc: [email protected]; Juraj Linkeš <[email protected]>
Subject: [PATCH v1] dts: add Dockerfile

The Dockerfile defines development and CI runner images.

---
 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
dts/.devcontainer/devcontainer.json new file +1 -0
new file mode 100644
index 0000000000..41ca28fc17
@@ -0,0 +1,30 @@
+// For format details, see https://aka.ms/devcontainer.json. For config

options, see the README at:

dts/.devcontainer/devcontainer.json

Quoted 7 lines
dts/.devcontainer/devcontainer.json new file +7 -0
+//
+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

dts/.devcontainer/devcontainer.json

Quoted 4 lines

folder.

dts/.devcontainer/devcontainer.json new file +3 -0
+     "context": "..",
+
+     // Update the 'dockerFile' property if you aren't using the

standard

Quoted 86 lines

'Dockerfile' filename.

dts/.devcontainer/devcontainer.json new file +3 -0
+     "dockerFile": "../Dockerfile",
+
+     // Use 'forwardPorts' to make a list of ports inside the container

available locally.

dts/.devcontainer/devcontainer.json new file +3 -0
+     // "forwardPorts": [],
+
+     // Uncomment the next line to run commands after the container is

created - for example installing curl.

dts/.devcontainer/devcontainer.json new file +7 -0
+     "postCreateCommand": "poetry install",
+
+     "extensions": [
+             "ms-python.vscode-pylance",
+     ]
+
+     // Uncomment when using a ptrace-based debugger like C++, Go,

and Rust

dts/.devcontainer/devcontainer.json new file +4 -0
+     // "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.

dts/.devcontainer/devcontainer.json new file +4 -0
+     // "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.

dts/.devcontainer/devcontainer.json new file +2 -0
+     // "remoteUser": "vscode"
+}
dts/Dockerfile new file mode 100644 index renamed from dts/Dockerfile +0 -0

0000000000..9a91949eeb

dts/Dockerfile new file +6 -0
@@ -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.

dts/Dockerfile new file +29 -0
+
+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.

dts/Dockerfile new file +3 -0
+
+RUN apt-get -y install --no-install-recommends \
+        vim emacs git
dts/README.md new file mode 100644 index renamed from dts/README.md +0 -0

0000000000..fd9f32595c

dts/README.md new file +3 -0
@@ -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.
+

Quoted 8 lines

+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-

Quoted 2 lines

metal os
+ can be whatever corporate policy or your personal preferences

dictate,

Quoted 9 lines

and DTS does

dts/README.md new file +5 -0
+   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

Quoted 3 lines

using a
+ distribution or Windows with out-of-date packages.
+7. Allows you to run the tester on Windows while developing via Docker

for

Quoted 37 lines

Windows.

dts/README.md new file +7 -0
+
+## 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.

dts/README.md new file +28 -0
+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
Quoted 3 lines

direction.
--
2.30.2

Signature · 9 lines
Patrick Robb

Technical Service Manager

UNH InterOperability Laboratory

21 Madbury Rd, Suite 100, Durham, NH 03824

www.iol.unh.edu
Acked-by Jeremy Spweock
#3 lore raw
Quoted 221 lines · Patrick Robb
Quoted 193 lines · Juraj Linkeš

Adding folks I forgot to add.

Quoted 25 lines

-----Original Message-----
From: Juraj Linkeš <[email protected]>
Sent: Thursday, November 3, 2022 2:47 PM
Cc: [email protected]; Juraj Linkeš <[email protected]>
Subject: [PATCH v1] dts: add Dockerfile

The Dockerfile defines development and CI runner images.

---
 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
dts/.devcontainer/devcontainer.json new file +0 -0
new file mode 100644
index 0000000000..41ca28fc17

dts/.devcontainer/devcontainer.json line 1

Quoted 1 line
dts/.devcontainer/devcontainer.json new file +1 -0
@@ -0,0 +1,30 @@
+// For format details, see https://aka.ms/devcontainer.json. For

config

dts/.devcontainer/devcontainer.json

Quoted 3 lines

options, see the README at:

dts/.devcontainer/devcontainer.json new file +2 -0
+//
+

https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/contai

dts/.devcontainer/devcontainer.json

Quoted 5 lines
dts/.devcontainer/devcontainer.json new file +5 -0
+ners/docker-existing-dockerfile
+{
+     "name": "Existing Dockerfile",
+
+     // Sets the run context to one level up instead of the

.devcontainer

dts/.devcontainer/devcontainer.json

Quoted 4 lines

folder.

dts/.devcontainer/devcontainer.json new file +3 -0
+     "context": "..",
+
+     // Update the 'dockerFile' property if you aren't using the

standard

Quoted 82 lines

'Dockerfile' filename.

dts/.devcontainer/devcontainer.json new file +3 -0
+     "dockerFile": "../Dockerfile",
+
+     // Use 'forwardPorts' to make a list of ports inside the container

available locally.

dts/.devcontainer/devcontainer.json new file +3 -0
+     // "forwardPorts": [],
+
+     // Uncomment the next line to run commands after the container is

created - for example installing curl.

dts/.devcontainer/devcontainer.json new file +7 -0
+     "postCreateCommand": "poetry install",
+
+     "extensions": [
+             "ms-python.vscode-pylance",
+     ]
+
+     // Uncomment when using a ptrace-based debugger like C++, Go,

and Rust

dts/.devcontainer/devcontainer.json new file +4 -0
+     // "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.

dts/.devcontainer/devcontainer.json new file +4 -0
+     // "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.

dts/.devcontainer/devcontainer.json new file +2 -0
+     // "remoteUser": "vscode"
+}
dts/Dockerfile new file mode 100644 index renamed from dts/Dockerfile +0 -0

0000000000..9a91949eeb

dts/Dockerfile new file +6 -0
@@ -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.

dts/Dockerfile new file +29 -0
+
+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.

dts/Dockerfile new file +3 -0
+
+RUN apt-get -y install --no-install-recommends \
+        vim emacs git
dts/README.md new file mode 100644 index renamed from dts/README.md +0 -0

0000000000..fd9f32595c

dts/README.md new file +3 -0
@@ -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
Quoted 8 lines

[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

Quoted 4 lines

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-

Quoted 2 lines

metal os
+ can be whatever corporate policy or your personal preferences

dictate,

Quoted 2 lines

and DTS does
+ not have to try to support all distros that are supported by DPDK

CI.

Quoted 7 lines

+4. It makes automated testing for DTS easier, since new dependencies

dts/README.md new file +3 -0
+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

Quoted 3 lines

using a
+ distribution or Windows with out-of-date packages.
+7. Allows you to run the tester on Windows while developing via Docker

for

dts/README.md

Quoted 8 lines

Windows.

dts/README.md new file +7 -0
+
+## 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

Quoted 26 lines

symlink from the host to the container.

dts/README.md new file +25 -0
+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.
Quoted 8 lines
Quoted 6 lines
dts/README.md new file +3 -0
+
+### Other
+Searching for '$IDE dev containers' will probably lead you in the right

direction.
--
2.30.2

--

Patrick Robb

Technical Service Manager

UNH InterOperability Laboratory

21 Madbury Rd, Suite 100, Durham, NH 03824

www.iol.unh.edu

Acked-by on v1 1/1
#4 lore raw
In reply to Juraj Linkeš
Quoted 12 lines · Juraj Linkeš

The Dockerfile defines development and CI runner images.

---
  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

[..]

#5 lore raw

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.

Quoted 20 lines · Paul Szczepanek
Quoted 12 lines · Juraj Linkeš

The Dockerfile defines development and CI runner images.

---
  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

[..]

#6 lore raw
Quoted 2 lines · Jeremy Spewock

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.

Quoted 23 lines · Paul Szczepanek
Quoted 20 lines · Juraj Linkeš
Quoted 12 lines

The Dockerfile defines development and CI runner images.

---
  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

[..]

#7 lore raw

PATCH v2 1/1 dts: add Dockerfile

In reply to Juraj Linkeš

From: Juraj Linkeš <[email protected]>

The Dockerfile defines development and CI runner images.

---
v2:

This verson updates the dockerfile to instead install poetry using pipx due to the version of poetry installed using the package repositories of the distro being out of date, and to conform to documentation on installing poetry.

This version also adds extra information to the README about the preference of using SSH keys, and added a way to inject them into the devcontainer for vscode.

 dts/.devcontainer/devcontainer.json | 33 ++++++++++++++
 dts/Dockerfile                      | 39 ++++++++++++++++
 dts/README.md                       | 70 +++++++++++++++++++++++++++++
 3 files changed, 142 insertions(+)
 create mode 100644 dts/.devcontainer/devcontainer.json
 create mode 100644 dts/Dockerfile
 create mode 100644 dts/README.md
dts/.devcontainer/devcontainer.json new file +33 -0
new file mode 100644
index 0000000000..7f77010428
@@ -0,0 +1,33 @@
+// 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 --no-root",
+
+	"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 mount your SSH keys into the devcontainer used by vscode.
+	// "mounts": ["source=${localEnv:HOME}/.ssh,destination=/root/.ssh,type=bind,readonly"]
+
+	// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
+	// "remoteUser": "vscode"
+}
dts/Dockerfile new file +39 -0
new file mode 100644
index 0000000000..46e5b1ff7e
@@ -0,0 +1,39 @@
+# 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 \
+        pipx \
+        python3-pexpect \
+        python3-cachecontrol \
+        openssh-client && \
+    pipx install poetry>=1.5.1 && pipx ensurepath
+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
dts/README.md new file +70 -0

70 lines not on this page · raw message

Signature · 1 line
2.43.0
#8 lore raw

PATCH v3 1/1 dts: add Dockerfile

From: Juraj Linkeš <[email protected]>

The Dockerfile defines development and CI runner images.

---
v3:

Remove pexpect.

v2:

This verson updates the dockerfile to instead install poetry using pipx due to the version of poetry installed using the package repositories of the distro being out of date, and to conform to documentation on installing poetry.

This version also adds extra information to the README about the preference of using SSH keys, and added a way to inject them into the devcontainer for vscode.

 dts/.devcontainer/devcontainer.json | 33 ++++++++++++++
 dts/Dockerfile                      | 38 ++++++++++++++++
 dts/README.md                       | 70 +++++++++++++++++++++++++++++
 3 files changed, 141 insertions(+)
 create mode 100644 dts/.devcontainer/devcontainer.json
 create mode 100644 dts/Dockerfile
 create mode 100644 dts/README.md
dts/.devcontainer/devcontainer.json new file +33 -0
new file mode 100644
index 0000000000..6313cd3ded
@@ -0,0 +1,33 @@
+// 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 --no-root",
+
+	"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 mount your SSH keys into the devcontainer used by vscode.
+	// "mounts": ["source=${localEnv:HOME}/.ssh,destination=/root/.ssh,type=bind,readonly"]
+
+	// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
+	// "remoteUser": "vscode"
+}
dts/Dockerfile new file +38 -0
new file mode 100644
index 0000000000..fa4c1af10e
@@ -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 \
+        pipx \
+        python3-cachecontrol \
+        openssh-client && \
+    pipx install poetry>=1.5.1 && pipx ensurepath
+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
dts/README.md new file +70 -0

70 lines not on this page · raw message

Signature · 1 line
2.43.0
#9 lore raw
Quoted 11 lines
dts/.devcontainer/devcontainer.json new file +5 -0
new file mode 100644
index 0000000000..6313cd3ded
@@ -0,0 +1,33 @@
+// 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",
+

dts/.devcontainer/devcontainer.json line 15

Quoted 10 lines
dts/.devcontainer/devcontainer.json new file +10 -0
+       // 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.

The next line is uncommented, we should update or remove the comment.

Quoted 4 lines
dts/.devcontainer/devcontainer.json new file +4 -0
+       "postCreateCommand": "poetry install --no-root",
+
+       "extensions": [
+               "ms-python.vscode-pylance",

dts/.devcontainer/devcontainer.json line 29

Quoted 10 lines
dts/.devcontainer/devcontainer.json new file +10 -0
+       ]
+
+       // 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 mount your SSH keys into the devcontainer used by vscode.
+       // "mounts": ["source=${localEnv:HOME}/.ssh,destination=/root/.ssh,type=bind,readonly"]

Should this SSH key correspond to the user below?

Quoted 4 lines
dts/.devcontainer/devcontainer.json new file +4 -0
+
+       // Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
+       // "remoteUser": "vscode"
+}

<snip>

Quoted 6 lines
dts/README.md new file +0 -0
new file mode 100644
index 0000000000..dc88ec585e
@@ -0,0 +1,70 @@

<snip>

dts/README.md line 35

Quoted 5 lines
dts/README.md new file +5 -0
+#### Start docker container with SSH keys
+
+```shell
+docker build --target dev -t dpdk-dts .
+docker run -v $(pwd)/..:/dpdk -v /home/dtsuser/.ssh:/root/.ssh:ro -it dpdk-dts bash

We talked about possibly baking the key into the image, but this seems safer and pretty easy to use.
I understand this is tailored to the lab and I'm thinking about other possible use cases, but it seems there would only be convoluted ones (possibly with some extra security considerations, which is generally not needed for testing purposes) where this doesn't do what we want it to. I'd say this is good enough.

Quoted 4 lines

+$ poetry install
+$ poetry shell
+```
+

#10 lore raw
Quoted 23 lines · Juraj Linkeš

Review

Quoted 1 line
(quoted diff) +0 -0

b/dts/.devcontainer/devcontainer.json

dts/.devcontainer/devcontainer.json line 1

Quoted 6 lines

new file mode 100644
index 0000000000..6313cd3ded

dts/.devcontainer/devcontainer.json new file +1 -0
@@ -0,0 +1,33 @@
+// For format details, see https://aka.ms/devcontainer.json. For

config options, see the README at:

dts/.devcontainer/devcontainer.json line 2

Quoted 1 line
dts/.devcontainer/devcontainer.json new file +1 -0
+//

https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/containers/docker-existing-dockerfile

dts/.devcontainer/devcontainer.json

Quoted 4 lines
dts/.devcontainer/devcontainer.json new file +4 -0
+{
+       "name": "Existing Dockerfile",
+
+       // Sets the run context to one level up instead of the

.devcontainer folder.

dts/.devcontainer/devcontainer.json

Quoted 3 lines
dts/.devcontainer/devcontainer.json new file +3 -0
+       "context": "..",
+
+       // Update the 'dockerFile' property if you aren't using the

standard 'Dockerfile' filename.

dts/.devcontainer/devcontainer.json

Quoted 3 lines
dts/.devcontainer/devcontainer.json new file +3 -0
+       "dockerFile": "../Dockerfile",
+
+       // Use 'forwardPorts' to make a list of ports inside the
Quoted 8 lines

container available locally.

dts/.devcontainer/devcontainer.json

Quoted 3 lines
dts/.devcontainer/devcontainer.json new file +3 -0
+       // "forwardPorts": [],
+
+       // Uncomment the next line to run commands after the container

is created - for example installing curl.

The next line is uncommented, we should update or remove the comment.

Good catch, I'll change this.

Quoted 15 lines

dts/.devcontainer/devcontainer.json

Quoted 8 lines
dts/.devcontainer/devcontainer.json new file +7 -0
+       "postCreateCommand": "poetry install --no-root",
+
+       "extensions": [
+               "ms-python.vscode-pylance",
+       ]
+
+       // Uncomment when using a ptrace-based debugger like C++, Go,

and Rust

dts/.devcontainer/devcontainer.json line 23

Quoted 1 line
dts/.devcontainer/devcontainer.json new file +1 -0
+       // "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt",

"seccomp=unconfined" ],

dts/.devcontainer/devcontainer.json line 25

Quoted 2 lines
dts/.devcontainer/devcontainer.json new file +2 -0
+
+       // Uncomment to use the Docker CLI from inside the container.

See https://aka.ms/vscode-remote/samples/docker-from-docker.

dts/.devcontainer/devcontainer.json line 26

Quoted 1 line
dts/.devcontainer/devcontainer.json new file +1 -0
+       // "mounts": [
Quoted 9 lines

"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],

dts/.devcontainer/devcontainer.json line 28

Quoted 2 lines
dts/.devcontainer/devcontainer.json new file +2 -0
+
+       // Uncomment to mount your SSH keys into the devcontainer used

by vscode.

dts/.devcontainer/devcontainer.json line 29

Quoted 1 line
dts/.devcontainer/devcontainer.json new file +1 -0
+       // "mounts":

["source=${localEnv:HOME}/.ssh,destination=/root/.ssh,type=bind,readonly"]

Should this SSH key correspond to the user below?

On one hand I agree it would be better to unify the two options, but on the other we don't make a remote user in the docker image so the option below can't be used anyway. I would be more in favor of just removing the remoteUser option and leaving this the way it is as that would line up better with what you can actually do with the container image we provide.

Leaving it as a stub for something that could be done isn't a bad either though, or I could also add the remote user to the container, but I don't really see the need for a non-root user for running DTS currently.

Quoted 37 lines

dts/.devcontainer/devcontainer.json line 31

Quoted 3 lines
dts/.devcontainer/devcontainer.json new file +2 -0
+
+       // Uncomment to connect as a non-root user if you've added one.

See https://aka.ms/vscode-remote/containers/non-root.

Quoted 2 lines
dts/.devcontainer/devcontainer.json new file +2 -0
+       // "remoteUser": "vscode"
+}

<snip>

Quoted 6 lines
dts/README.md new file +0 -0
new file mode 100644
index 0000000000..dc88ec585e
@@ -0,0 +1,70 @@

<snip>

dts/README.md

Quoted 5 lines
dts/README.md new file +5 -0
+#### Start docker container with SSH keys
+
+```shell
+docker build --target dev -t dpdk-dts .
+docker run -v $(pwd)/..:/dpdk -v /home/dtsuser/.ssh:/root/.ssh:ro -it

dpdk-dts bash

We talked about possibly baking the key into the image, but this seems safer and pretty easy to use.
I understand this is tailored to the lab and I'm thinking about other possible use cases, but it seems there would only be convoluted ones (possibly with some extra security considerations, which is generally not needed for testing purposes) where this doesn't do what we want it to. I'd say this is good enough.

+$ poetry install

Quoted 3 lines

+$ poetry shell
+```
+

#11 lore raw
Quoted 52 lines · Jeremy Spewock
Quoted 16 lines · Juraj Linkeš
Quoted 16 lines
dts/.devcontainer/devcontainer.json new file +9 -0
new file mode 100644
index 0000000000..6313cd3ded
@@ -0,0 +1,33 @@
+// 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.
Quoted 8 lines

dts/.devcontainer/devcontainer.json line 15

Quoted 6 lines
dts/.devcontainer/devcontainer.json new file +6 -0
+       "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.

The next line is uncommented, we should update or remove the comment.

Good catch, I'll change this.

Quoted 18 lines
Quoted 6 lines
dts/.devcontainer/devcontainer.json new file +4 -0
+       "postCreateCommand": "poetry install --no-root",
+
+       "extensions": [
+               "ms-python.vscode-pylance",

dts/.devcontainer/devcontainer.json line 29

Quoted 10 lines
dts/.devcontainer/devcontainer.json new file +10 -0
+       ]
+
+       // 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 mount your SSH keys into the devcontainer used by vscode.
+       // "mounts": ["source=${localEnv:HOME}/.ssh,destination=/root/.ssh,type=bind,readonly"]

Should this SSH key correspond to the user below?

Quoted 4 lines

On one hand I agree it would be better to unify the two options, but on the other we don't make a remote user in the docker image so the option below can't be used anyway. I would be more in favor of just removing the remoteUser option and leaving this the way it is as that would line up better with what you can actually do with the container image we provide.

Leaving it as a stub for something that could be done isn't a bad either though, or I could also add the remote user to the container, but I don't really see the need for a non-root user for running DTS currently.

Thanks for the explanation. As there is no need for it and adding things that could be done (in other tools) seems out of scope to me, let's remove it.

Quoted 35 lines
Quoted 35 lines
Quoted 6 lines
dts/.devcontainer/devcontainer.json new file +4 -0
+
+       // Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
+       // "remoteUser": "vscode"
+}

<snip>

Quoted 6 lines
dts/README.md new file +0 -0
new file mode 100644
index 0000000000..dc88ec585e
@@ -0,0 +1,70 @@

<snip>

dts/README.md line 35

Quoted 5 lines
dts/README.md new file +5 -0
+#### Start docker container with SSH keys
+
+```shell
+docker build --target dev -t dpdk-dts .
+docker run -v $(pwd)/..:/dpdk -v /home/dtsuser/.ssh:/root/.ssh:ro -it dpdk-dts bash

We talked about possibly baking the key into the image, but this seems safer and pretty easy to use.
I understand this is tailored to the lab and I'm thinking about other possible use cases, but it seems there would only be convoluted ones (possibly with some extra security considerations, which is generally not needed for testing purposes) where this doesn't do what we want it to. I'd say this is good enough.

Quoted 4 lines

+$ poetry install
+$ poetry shell
+```
+

#12 lore raw

PATCH v4 1/1 dts: add Dockerfile

In reply to [email protected]

From: Juraj Linkeš <[email protected]>

The Dockerfile defines development and CI runner images.

---
v4:

Remove an example from and updated a comment in the devcontainer.json and added the --no-root flag to the README to comply with the warning message and the discussion on slack.

v3:

Remove pexpect.

v2:

This verson updates the dockerfile to instead install poetry using pipx due to the version of poetry installed using the package repositories of the distro being out of date, and to conform to documentation on installing poetry.

This version also adds extra information to the README about the preference of using SSH keys, and added a way to inject them into the devcontainer for vscode.

 dts/.devcontainer/devcontainer.json | 30 +++++++++++++
 dts/Dockerfile                      | 38 ++++++++++++++++
 dts/README.md                       | 70 +++++++++++++++++++++++++++++
 3 files changed, 138 insertions(+)
 create mode 100644 dts/.devcontainer/devcontainer.json
 create mode 100644 dts/Dockerfile
 create mode 100644 dts/README.md
dts/.devcontainer/devcontainer.json new file +30 -0
new file mode 100644
index 0000000000..4d737f1b40
@@ -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": [],
+
+	// The next line runs commands after the container is created - in our case, installing dependencies.
+	"postCreateCommand": "poetry install --no-root",
+
+	"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 mount your SSH keys into the devcontainer used by vscode.
+	// "mounts": ["source=${localEnv:HOME}/.ssh,destination=/root/.ssh,type=bind,readonly"]
+}
dts/Dockerfile new file +38 -0
new file mode 100644
index 0000000000..fa4c1af10e
@@ -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 \
+        pipx \
+        python3-cachecontrol \
+        openssh-client && \
+    pipx install poetry>=1.5.1 && pipx ensurepath
+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
dts/README.md new file +70 -0

70 lines not on this page · raw message

Signature · 1 line
2.43.0
Tested-by on v4 1/1
#14 lore raw
In reply to [email protected]

The approach for mounting in ssh keys and managing the test engine environment has been agreed upon by the CI group, and this patch has been tested by a few people at the Community Lab. I believe it is ready to be merged.

Quoted 9 lines · On Tue, Jan 16, 2024 at 2:18 PM <[email protected]> wrote:

From: Juraj Linkeš <[email protected]>

The Dockerfile defines development and CI runner images.

#15 lore raw

21/02/2024 04:40, Patrick Robb:

Quoted 6 lines

The approach for mounting in ssh keys and managing the test engine environment has been agreed upon by the CI group, and this patch has been tested by a few people at the Community Lab. I believe it is ready to be merged.

Applied, thanks.

Note: few minor adjustments were made in the README and devtools.

A message that is not in the archive (sent off-list or not yet received): CAJvnSUDDpGdxe8D-GmtbVixrrrB_GRfvS985Cw1RLx79aLcXnA@mail.gmail.com

Tested-by
#17 lore raw
Quoted 253 lines · Patrick Robb

---------- Forwarded message ---------
From: <[email protected]>
Date: Tue, Jan 16, 2024 at 2:18 PM
Subject: [PATCH v4] dts: add Dockerfile
To: <[email protected]>, <[email protected]>, < [email protected]>, <[email protected]>, <[email protected]>, < [email protected]>, <[email protected]>
Cc: <[email protected]>, Jeremy Spewock <[email protected]>

From: Juraj Linkeš <[email protected]>

The Dockerfile defines development and CI runner images.

---
v4:

Remove an example from and updated a comment in the devcontainer.json and added the --no-root flag to the README to comply with the warning message and the discussion on slack.

v3:

Remove pexpect.

v2:

This verson updates the dockerfile to instead install poetry using pipx due to the version of poetry installed using the package repositories of the distro being out of date, and to conform to documentation on installing poetry.

This version also adds extra information to the README about the preference of using SSH keys, and added a way to inject them into the devcontainer for vscode.

 dts/.devcontainer/devcontainer.json | 30 +++++++++++++
 dts/Dockerfile                      | 38 ++++++++++++++++
 dts/README.md                       | 70 +++++++++++++++++++++++++++++
 3 files changed, 138 insertions(+)
 create mode 100644 dts/.devcontainer/devcontainer.json
 create mode 100644 dts/Dockerfile
 create mode 100644 dts/README.md
dts/.devcontainer/devcontainer.json new file +1 -0
new file mode 100644
index 0000000000..4d737f1b40
@@ -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

dts/.devcontainer/devcontainer.json new file +4 -0
+{
+       "name": "Existing Dockerfile",
+
+       // Sets the run context to one level up instead of the

.devcontainer folder.

dts/.devcontainer/devcontainer.json new file +3 -0
+       "context": "..",
+
+       // Update the 'dockerFile' property if you aren't using the

standard 'Dockerfile' filename.

dts/.devcontainer/devcontainer.json new file +3 -0
+       "dockerFile": "../Dockerfile",
+
+       // Use 'forwardPorts' to make a list of ports inside the container

available locally.

dts/.devcontainer/devcontainer.json new file +3 -0
+       // "forwardPorts": [],
+
+       // The next line runs commands after the container is created - in

our case, installing dependencies.

dts/.devcontainer/devcontainer.json new file +7 -0
+       "postCreateCommand": "poetry install --no-root",
+
+       "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" ],

dts/.devcontainer/devcontainer.json new file +2 -0
+
+       // 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" ],

dts/.devcontainer/devcontainer.json new file +2 -0
+
+       // Uncomment to mount your SSH keys into the devcontainer used by

vscode.
+ // "mounts":
["source=${localEnv:HOME}/.ssh,destination=/root/.ssh,type=bind,readonly"]

dts/.devcontainer/devcontainer.json new file +1 -0
+}
dts/Dockerfile new file +6 -0
new file mode 100644
index 0000000000..fa4c1af10e
@@ -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.

dts/Dockerfile new file +27 -0
+
+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 \
+        pipx \
+        python3-cachecontrol \
+        openssh-client && \
+    pipx install poetry>=1.5.1 && pipx ensurepath
+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,

dts/Dockerfile new file +4 -0
+# the dependencies should be installed using Poetry.
+
+RUN apt-get -y install --no-install-recommends \
+        vim emacs git
dts/README.md new file +3 -0
new file mode 100644
index 0000000000..36c8cc9a0c
@@ -0,0 +1,70 @@
+# DTS Environment
+The execution and development environments for DTS are the same, a
+[Docker](https://docs.docker.com/) container defined by our

[Dockerfile](./Dockerfile).

dts/README.md new file +3 -0
+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.

dts/README.md new file +5 -0
+
+## 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. It is also strongly recommended that you mount your SSH
+keys into the container to allow you to connect to hosts without specifying a password.

dts/README.md new file +6 -0
+
+#### Start docker container with SSH keys
+
+```shell
+docker build --target dev -t dpdk-dts .
+docker run -v $(pwd)/..:/dpdk -v /home/dtsuser/.ssh:/root/.ssh:ro -it

dpdk-dts bash
+$ poetry install --no-root
+$ poetry shell
+```

dts/README.md new file +12 -0
+
+#### Start docker container without SSH keys
+
+```shell
+docker build --target dev -t dpdk-dts .
+docker run -v $(pwd)/..:/dpdk -it dpdk-dts bash
+$ poetry install --no-root
+$ 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

dts/README.md new file +4 -0
+preferred settings.
+
+```shell
+docker run -v ${HOME}/.vimrc:/root/.vimrc -v $(pwd)/..:/dpdk -it dpdk-dts

bash
+```

dts/README.md new file +3 -0
+
+### 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. Additionally, there is a line in .devcontainer/devcontainer.json
+that, when included, will mount the SSH keys of the user currently running vscode into
+the container for you. The source on this line can be altered to mount any SSH keys on

dts/README.md new file +4 -0
+the local machine into the container at the correct location.
+
+### Other
+Searching for '$IDE dev containers' will probably lead you in the right

direction.
--
2.43.0