From 3d9f3630d777aae636b49ec938ea1b659adfeb02 Mon Sep 17 00:00:00 2001 From: bhack Date: Tue, 23 Jun 2020 18:21:30 +0200 Subject: [PATCH 1/4] Tensorflow devcontainer --- .../tensorflow/.devcontainer/Dockerfile | 42 ++++++++++++++++ .../.devcontainer/devcontainer.json | 50 +++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 repository-containers/github.com/tensorflow/tensorflow/.devcontainer/Dockerfile create mode 100644 repository-containers/github.com/tensorflow/tensorflow/.devcontainer/devcontainer.json diff --git a/repository-containers/github.com/tensorflow/tensorflow/.devcontainer/Dockerfile b/repository-containers/github.com/tensorflow/tensorflow/.devcontainer/Dockerfile new file mode 100644 index 0000000000..48a53749c4 --- /dev/null +++ b/repository-containers/github.com/tensorflow/tensorflow/.devcontainer/Dockerfile @@ -0,0 +1,42 @@ +#------------------------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. +#------------------------------------------------------------------------------------------------------------- +ARG IMAGE_TYPE +FROM tensorflow/tensorflow:devel$IMAGE_TYPE + +# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser" +# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs +# will be updated to match your local UID/GID (when using the dockerFile property). +# See https://aka.ms/vscode-remote/containers/non-root-user for details. +ARG USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# Options for common package install script - SHA updated on release +ARG INSTALL_ZSH="false" +ARG UPGRADE_PACKAGES="false" +ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/script-library/common-debian.sh" +ARG COMMON_SCRIPT_SHA="dev-mode" + +# Configure apt and install packages +RUN apt-get update \ + && export DEBIAN_FRONTEND=noninteractive \ + # + # Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh + && apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \ + && curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \ + && ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/common-setup.sh" | sha256sum -c -)) \ + && /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \ + && rm /tmp/common-setup.sh \ + # + # ********************************************************************* + # * Uncomment this section to use RUN to install other dependencies. * + # * See https://aka.ms/vscode-remote/containers/dockerfile-run * + # ********************************************************************* + # && apt-get -y install --no-install-recommends + # + # Clean up + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/repository-containers/github.com/tensorflow/tensorflow/.devcontainer/devcontainer.json b/repository-containers/github.com/tensorflow/tensorflow/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..46a22eb547 --- /dev/null +++ b/repository-containers/github.com/tensorflow/tensorflow/.devcontainer/devcontainer.json @@ -0,0 +1,50 @@ +{ + "name": "Tensorflow Dev Container", + + "dockerFile": "Dockerfile", + + // Uncomment this for GPU image + // "build": { + // "args": { + // "IMAGE_TYPE": "-gpu" + // } + // }, + + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": "/bin/bash", + "python.testing.pytestEnabled": true, + "python.testing.pytestArgs": [ + "./tensorflow" + ], + "C_Cpp.clang_format_style": "{BasedOnStyle: Google}", + "C_Cpp.default.includePath": [ + "${workspaceFolder}/**", + ], + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-python.python", + "ms-vscode.cpptools", + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "uname -a", + "mounts": [ + "source=tensorflow_cache,target=/home/vscode/.cache" + ], + + // Uncomment when using a ptrace-based debugger like C++, Go, and Rust + "runArgs": [ + "--cap-add=SYS_PTRACE", + // Uncomment this to enable Nvidia support + //"--runtime=nvidia", + "--security-opt", + "seccomp=unconfined" ], + "remoteUser": "1000" +} From 347a8cbd933b7fa7d54407e4fa6b6b963539c60b Mon Sep 17 00:00:00 2001 From: bhack Date: Wed, 24 Jun 2020 12:53:04 +0200 Subject: [PATCH 2/4] Exclude bazel generated dirs from search and watch --- .../tensorflow/tensorflow/.devcontainer/devcontainer.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/repository-containers/github.com/tensorflow/tensorflow/.devcontainer/devcontainer.json b/repository-containers/github.com/tensorflow/tensorflow/.devcontainer/devcontainer.json index 46a22eb547..fd2c0918ad 100644 --- a/repository-containers/github.com/tensorflow/tensorflow/.devcontainer/devcontainer.json +++ b/repository-containers/github.com/tensorflow/tensorflow/.devcontainer/devcontainer.json @@ -21,7 +21,13 @@ "C_Cpp.clang_format_style": "{BasedOnStyle: Google}", "C_Cpp.default.includePath": [ "${workspaceFolder}/**", - ], + ], + "files.watcherExclude": { + "**/bazel-*/**": true + }, + "search.exclude": { + "**/bazel-*/**": true + } }, // Add the IDs of extensions you want installed when the container is created. From 26726532794b131c6f4476f84ad4dfe83d260ca3 Mon Sep 17 00:00:00 2001 From: bhack Date: Wed, 24 Jun 2020 16:21:30 +0200 Subject: [PATCH 3/4] Limit bazel cache subdir --- .../tensorflow/tensorflow/.devcontainer/devcontainer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repository-containers/github.com/tensorflow/tensorflow/.devcontainer/devcontainer.json b/repository-containers/github.com/tensorflow/tensorflow/.devcontainer/devcontainer.json index fd2c0918ad..a6a813e11e 100644 --- a/repository-containers/github.com/tensorflow/tensorflow/.devcontainer/devcontainer.json +++ b/repository-containers/github.com/tensorflow/tensorflow/.devcontainer/devcontainer.json @@ -42,7 +42,7 @@ // Use 'postCreateCommand' to run commands after the container is created. // "postCreateCommand": "uname -a", "mounts": [ - "source=tensorflow_cache,target=/home/vscode/.cache" + "source=tensorflow_cache,target=/home/vscode/.cache/bazel/" ], // Uncomment when using a ptrace-based debugger like C++, Go, and Rust @@ -52,5 +52,5 @@ //"--runtime=nvidia", "--security-opt", "seccomp=unconfined" ], - "remoteUser": "1000" + "remoteUser": "vscode" } From 0dc090cf74452dbf0ba66b23f1aa6f87c7527251 Mon Sep 17 00:00:00 2001 From: bhack Date: Wed, 24 Jun 2020 16:22:13 +0200 Subject: [PATCH 4/4] Small fixes