From 3f0fedb2cbe3d117cefc07cc0973d2b7a231e37b Mon Sep 17 00:00:00 2001 From: "Dan Taylor (VS)" Date: Tue, 16 Apr 2019 00:51:20 -0700 Subject: [PATCH] add anaconda container --- .../.devcontainer/Dockerfile | 28 +++++++++++++++++++ .../.devcontainer/devcontainer.json | 10 +++++++ .../.devcontainer/docker-compose.yml | 12 ++++++++ .../.devcontainer/environment.yml.temp | 0 .../.devcontainer/settings.vscode.json | 3 ++ containers/python-3-anaconda/.npmignore | 4 +++ .../python-3-anaconda/.vscode/launch.json | 15 ++++++++++ .../python-3-anaconda/.vscode/settings.json | 3 ++ containers/python-3-anaconda/README.md | 27 ++++++++++++++++++ 9 files changed, 102 insertions(+) create mode 100644 containers/python-3-anaconda/.devcontainer/Dockerfile create mode 100644 containers/python-3-anaconda/.devcontainer/devcontainer.json create mode 100644 containers/python-3-anaconda/.devcontainer/docker-compose.yml create mode 100644 containers/python-3-anaconda/.devcontainer/environment.yml.temp create mode 100644 containers/python-3-anaconda/.devcontainer/settings.vscode.json create mode 100644 containers/python-3-anaconda/.npmignore create mode 100644 containers/python-3-anaconda/.vscode/launch.json create mode 100644 containers/python-3-anaconda/.vscode/settings.json create mode 100644 containers/python-3-anaconda/README.md diff --git a/containers/python-3-anaconda/.devcontainer/Dockerfile b/containers/python-3-anaconda/.devcontainer/Dockerfile new file mode 100644 index 0000000000..7c26443580 --- /dev/null +++ b/containers/python-3-anaconda/.devcontainer/Dockerfile @@ -0,0 +1,28 @@ +#----------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See LICENSE in the project root for license information. +#----------------------------------------------------------------------------------------- + +FROM continuumio/anaconda3 + +# Copy default endpoint specific user settings overrides into container to specify Python path +COPY .devcontainer/settings.vscode.json /root/.vscode-remote/data/Machine/settings.json + +# Install git, process tools +RUN apt-get update && apt-get -y install git procps + +# Install any missing dependencies for enhanced language service +RUN apt-get install -y libicu[0-9][0-9] + +# Install Python dependencies from requirements.txt if it exists +COPY .devcontainer/environment.yml.temp environment.yml* /workspace/ +RUN if [ -f "environment.yml" ]; then conda install environment.yml && rm environment.yml*; fi + +# Expose port 5000 as the default web port +EXPOSE 5000 + +# Clean up +RUN apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + diff --git a/containers/python-3-anaconda/.devcontainer/devcontainer.json b/containers/python-3-anaconda/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..eb62c26830 --- /dev/null +++ b/containers/python-3-anaconda/.devcontainer/devcontainer.json @@ -0,0 +1,10 @@ +{ + "name": "Anaconda 3", + "dockerComposeFile": "docker-compose.yml", + "service": "app", + "workspaceFolder": "/workspace", + "extensions": [ + "ms-python.python", + "VisualStudioExptTeam.vscodeintellicode" + ] +} \ No newline at end of file diff --git a/containers/python-3-anaconda/.devcontainer/docker-compose.yml b/containers/python-3-anaconda/.devcontainer/docker-compose.yml new file mode 100644 index 0000000000..9216ed013b --- /dev/null +++ b/containers/python-3-anaconda/.devcontainer/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3' + +services: + app: + build: + context: .. + dockerfile: .devcontainer/Dockerfile + ports: + - 5000:5000 + volumes: + - ..:/workspace + command: sleep infinity diff --git a/containers/python-3-anaconda/.devcontainer/environment.yml.temp b/containers/python-3-anaconda/.devcontainer/environment.yml.temp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/containers/python-3-anaconda/.devcontainer/settings.vscode.json b/containers/python-3-anaconda/.devcontainer/settings.vscode.json new file mode 100644 index 0000000000..1b3cd28238 --- /dev/null +++ b/containers/python-3-anaconda/.devcontainer/settings.vscode.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "/opt/conda/bin/python" +} \ No newline at end of file diff --git a/containers/python-3-anaconda/.npmignore b/containers/python-3-anaconda/.npmignore new file mode 100644 index 0000000000..1d72d293eb --- /dev/null +++ b/containers/python-3-anaconda/.npmignore @@ -0,0 +1,4 @@ +README.md +test-project +.vscode +.npmignore diff --git a/containers/python-3-anaconda/.vscode/launch.json b/containers/python-3-anaconda/.vscode/launch.json new file mode 100644 index 0000000000..1298fb1ca1 --- /dev/null +++ b/containers/python-3-anaconda/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File (Integrated Terminal)", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal" + } + ] +} \ No newline at end of file diff --git a/containers/python-3-anaconda/.vscode/settings.json b/containers/python-3-anaconda/.vscode/settings.json new file mode 100644 index 0000000000..1b3cd28238 --- /dev/null +++ b/containers/python-3-anaconda/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "/opt/conda/bin/python" +} \ No newline at end of file diff --git a/containers/python-3-anaconda/README.md b/containers/python-3-anaconda/README.md new file mode 100644 index 0000000000..d3f706a76a --- /dev/null +++ b/containers/python-3-anaconda/README.md @@ -0,0 +1,27 @@ +# Python 3 + +## Summary + +*A basic dev container definition for developing Python 3 applications in an Anaconda container. Installs dependencies from your environment.yml file and the Python extension.* + +| Metadata | Value | +|----------|-------| +| *Contributors* | The VS Code Team | +| *Definition type* | Dockerfile | +| *Languages, platforms* | Python | + +## Usage + +[See here for information on using this definition with an existing project](../../README.md#using-a-definition). + +If you prefer, you can also just look through the contents of the `.devcontainer` folder to understand how to make changes to your own project. + +If you want to try out the test project instead, run **Remote-Container: Open Folder in Container...** in VS Code and select a cloned copy of the entire folder. + +Then, open test-project/hello.py and press shift-enter to run the cell and see the interactive matplotlib output. + +## License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Licensed under the MIT License. See [LICENSE](../../LICENSE).