On Tue, Sep 13, 2022 at 08:38:06PM +0000, Honnappa Nagarahalli wrote:
> (I have lost the original patch emails due to quarantine policy, apologies 
> for using this thread for my comments)
> 
> <snip>
> 
> > >
> > > On Fri, Jul 29, 2022 at 10:55:43AM +0000, Juraj Linkeš wrote:
> > > > The Dockerfile contains basic image for CI and developers. There's
> > > > also an integration of the Dockerfile with Visual Studio.
> > > >
> > > > The formatter script uses Black and Isort to format the Python code.
> > > >
> > > > Signed-off-by: Owen Hilyard <ohily...@iol.unh.edu>
> > > > Signed-off-by: Juraj Linkeš <juraj.lin...@pantheon.tech>
> > >
> > > Comments inline below.
> > >
> > > Thanks,
> > > /Bruce
> > >
> > > > ---
> > > >  dts/.devcontainer/devcontainer.json | 30 ++++++++++++
> > > >  dts/Dockerfile                      | 38 +++++++++++++++
> > > >  dts/README.md                       | 74 ++++++++++++++++++++++++++++-
> > > >  dts/format.sh                       | 45 ++++++++++++++++++
> > > >  4 files changed, 186 insertions(+), 1 deletion(-)  create mode
> > > > 100644 dts/.devcontainer/devcontainer.json
> > > >  create mode 100644 dts/Dockerfile
> > > >  create mode 100755 dts/format.sh
> > > >
> > > > 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/co
> > > > +nt
> > > > +ainers/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..6700aa45b8
> > > > --- /dev/null
> > > > +++ b/dts/Dockerfile
> > > > @@ -0,0 +1,38 @@
> > > > +# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2022
> > > > +University of New Hampshire #
> > > > +
> Is it possible to add some text here talking about the use of this file?
> 
> > > > +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
> > > > +
> > > > +
> > > > +FROM base AS runner
> > > > +
> > > > +# This container is intended to be used as the base for automated 
> > > > systems.
> > > > +# It bakes DTS into the container during the build.
> > > > +
> > > > +RUN mkdir /dts
> > > > +COPY ./pyproject.toml /dts/pyproject.toml COPY ./poetry.lock
> > > > +/dts/poetry.lock WORKDIR /dts RUN poetry install --no-dev COPY .
> > > > +/dts
> > >
> > > Two questions here:
> > > * if we copy over the current folder, does it re-copy the same two files
> > >   above, or do we get a new subfolder with the same name as the current
> > >   one (and the two files in that instead)?
> > > * Can the commands be re-ordered so that we have all the copies together
> > >   rather than being split either side of the workdir and run commands?
> > >
> > 
> > Yea, we don't need to copy the two files individually - we only need to 
> > copy the
> > whole dts folder. I'll move the commands.
> > 
> > > > +
> > > > +CMD ["poetry", "run", "python", "main.py"]
> > > > +
> > > > +FROM base AS dev
> > > > +
> > > > +# This container is intended to be used as a development environment.
> May be s/development environment/DTS development environment/
> 
> > > > +
> > > > +RUN apt-get -y install --no-install-recommends \
> > > > +        vim emacs git
> > > > +
> > > If it's to be used as a development environment, do we not need
> > > build-essential installed?
> > >
> > 
> > It's meant to be a DTS development environment and we don't need to build
> > anything for that, so no need for build-essential.
> The above addition will clarify this.
> 

I would still make it explicit. Change "dev env" to "DTS dev env" as you
suggest, but also add that it requires python only, and not C compilation
capability.

/Bruce

Reply via email to