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