From cc370a5dd118085ef6f506b8e803358044f757f2 Mon Sep 17 00:00:00 2001 From: Jiri Podivin Date: Mon, 30 Jan 2023 13:28:13 +0100 Subject: [PATCH] Adjusting developer container file to ensure smoother integration with IDE Adjusted container file will provide pytest framework out of the box to facilitate testing code from VS code IDE. Package installation layers were consolidated in order to minimize image size. Default devcontainer configuration was added. Signed-off-by: Jiri Podivin Change-Id: Id9fb1bf52bdf4c9d0bad09cd9604c4a4114c5b62 --- .devcontainer/devcontainer.json | 41 +++++++++++++++++++++++++++++++++ Dockerfile | 12 ++++++---- 2 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..40d4b876 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,41 @@ +// 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.155.1/containers/docker-existing-dockerfile +{ + "name": "Existing Dockerfile", + + // Sets the run context to one level up instead of the .devcontainer folder. + "context": "..", + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": null, + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-python.python" + ], + + "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": "apt-get update && apt-get install -y curl", + + // 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" + + // Required for an empty mount arg, since we manually add it in the runArgs + "workspaceMount": "", + "runArgs": [ + "--volume=${localWorkspaceFolder}:/workspaces/${localWorkspaceFolderBasename}:Z" + ] +} diff --git a/Dockerfile b/Dockerfile index 47a238d3..0db77051 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM redhat/ubi9:latest LABEL name="VF development container file" -LABEL version="1.0" +LABEL version="1.1" LABEL description="Provides environment for development of new validations." RUN dnf install -y git python3-pip gcc python3-devel jq @@ -11,10 +11,12 @@ COPY . /root/validations-libs # validations-common repo is cloned RUN git clone https://opendev.org/openstack/validations-common /root/validations-common -RUN python3 -m pip install /root/validations-libs &&\ - python3 -m pip install -r /root/validations-libs/test-requirements.txt - -RUN python3 -m pip install /root/validations-common +# Install wheel, validations-libs, validations-common, pytest and all dependencies +RUN python3 -m pip install wheel &&\ + python3 -m pip install /root/validations-libs &&\ + python3 -m pip install -r /root/validations-libs/test-requirements.txt &&\ + python3 -m pip install pytest &&\ + python3 -m pip install /root/validations-common # Setting up the default directory structure for both ansible, # and the VF