From 0dc3fff78c1204515c2d8ce6179fa42203470645 Mon Sep 17 00:00:00 2001 From: Shikanime Deva Date: Thu, 16 May 2019 10:12:03 +0200 Subject: [PATCH] Add Bazel container --- containers/bazel/.devcontainer/Dockerfile | 33 +++++++++++++ .../bazel/.devcontainer/devcontainer.json | 17 +++++++ containers/bazel/.npmignore | 4 ++ containers/bazel/README.md | 48 +++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 containers/bazel/.devcontainer/Dockerfile create mode 100644 containers/bazel/.devcontainer/devcontainer.json create mode 100644 containers/bazel/.npmignore create mode 100644 containers/bazel/README.md diff --git a/containers/bazel/.devcontainer/Dockerfile b/containers/bazel/.devcontainer/Dockerfile new file mode 100644 index 0000000000..730c3b0773 --- /dev/null +++ b/containers/bazel/.devcontainer/Dockerfile @@ -0,0 +1,33 @@ +#------------------------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. +#------------------------------------------------------------------------------------------------------------- +FROM debian:9 + +# Configure apt +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get -y install --no-install-recommends apt-utils 2>&1 + +# Install git, process tools, lsb-release (common in install instructions for CLIs) +RUN apt-get -y install git procps lsb-release + +# Install Bazel +ENV BAZEL_VERSION=0.25.2 +ENV BAZEL_SHA256=7ca3bbec5730afc3732514cbebb1e8f451df455d85d6bed5eb5614c2bfe36f13 +RUN apt-get -y install curl pkg-config zip g++ zlib1g-dev unzip python +RUN curl -fSsL -o bazel-installer.sh https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh \ + && chmod +x bazel-installer.sh \ + && ./bazel-installer.sh --user \ + && rm ./bazel-installer.sh + +RUN echo '\n\ +export PATH="$PATH:$HOME/bin" \n\ +'\ +>> $HOME/.bashrc + +# Clean up +RUN apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* +ENV DEBIAN_FRONTEND=dialog diff --git a/containers/bazel/.devcontainer/devcontainer.json b/containers/bazel/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..d67b3c41f8 --- /dev/null +++ b/containers/bazel/.devcontainer/devcontainer.json @@ -0,0 +1,17 @@ +{ + "name": "Bazel", + "dockerFile": "Dockerfile", + + // Uncomment the next line to automatically install extensions. + // "extensions": [], + + // Uncomment the next line if you want to publish any ports. + // "appPort": [], + + // Uncomment the next line to run commands after the container is created. + // "postCreateCommand": "uname -a", + + // Uncomment the next line if you will use a ptrace-based debugger like C++, Go, and Rust. + // "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ] + +} \ No newline at end of file diff --git a/containers/bazel/.npmignore b/containers/bazel/.npmignore new file mode 100644 index 0000000000..1d72d293eb --- /dev/null +++ b/containers/bazel/.npmignore @@ -0,0 +1,4 @@ +README.md +test-project +.vscode +.npmignore diff --git a/containers/bazel/README.md b/containers/bazel/README.md new file mode 100644 index 0000000000..3e8084a5e3 --- /dev/null +++ b/containers/bazel/README.md @@ -0,0 +1,48 @@ +# BAzel + +## Summary + +*Develop and compile efficiently on any language with the Bazel compilation tool.* + +| Metadata | Value | +|----------|-------| +| *Contributors* | The VS Code Team | +| *Definition type* | Dockerfile | +| *Languages, platforms* | Any | + +## Using this definition with an existing folder + +This definition does not require any special steps to use. Just follow these steps: + +1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine. + +2. To use VS Code's copy of this definition: + 1. Start VS Code and open your project folder. + 2. Press F1 select and **Remote-Containers: Create Container Configuration File...** from the command palette. + 3. Select the Bazel definition. + +3. To use latest-and-greatest copy of this definition from the repository: + 1. Clone this repository. + 2. Copy the contents of `containers/bazel/.devcontainer` to the root of your project folder. + 3. Start VS Code and open your project folder. + +4. After following step 2 or 3, the contents of the `.devcontainer` folder in your project can be adapted to meet your needs. + +5. Finally, press F1 and run **Remote-Containers: Reopen Folder in Container** to start using the definition. + +## Testing the definition + +This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps: + +1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine. +2. Clone this repository. +3. Start VS Code, press F1, and select **Remote-Containers: Open Folder in Container...** +4. Select the `containers/bazel` folder. +5. Press ctrl+shift+` and type the following command to verify installation: `apt-get update && apt-get install -y lsb-release && git --version && lsb_release -a` +6. After lsb_release installs, you should see the Git version and details about the version of Linux in the container. + +## License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Licensed under the MIT License. See [LICENSE](https://github.com/Microsoft/vscode-dev-containers/blob/master/LICENSE)