Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit 77afdf0

Browse files
authored
Clarify usage, misc corrections (#1117)
1 parent 56d78a9 commit 77afdf0

File tree

15 files changed

+95
-20
lines changed

15 files changed

+95
-20
lines changed

containers/codespaces-linux/.devcontainer/setup-user.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,22 @@ groupadd -g 800 docker
1717
usermod -a -G docker ${USERNAME}
1818

1919
# Create user's .local/bin
20-
sudo -u ${USERNAME} mkdir -p /home/${USERNAME}/.local/bin
20+
sudo -u ${USERNAME} mkdir -p /home/${USERNAME}/.local/bin
21+
22+
# Display a notice on conda when not running in GitHub Codespaces
23+
cat << 'EOF' > /usr/local/etc/vscode-dev-containers/conda-notice.txt
24+
When using "conda" from outside of GitHub Codespaces, note the Anaconda repository contains
25+
restrictions on commercial use that may impact certain organizations. See https://aka.ms/ghcs-conda
26+
27+
EOF
28+
29+
notice_script="$(cat << 'EOF'
30+
if [ -t 1 ] && [ "${IGNORE_NOTICE}" != "true" ] && [ "${TERM_PROGRAM}" = "vscode" ] && [ "${CODESPACES}" != "true" ] && [ ! -f "$HOME/.config/vscode-dev-containers/conda-notice-already-displayed" ]; then
31+
cat "/usr/local/etc/vscode-dev-containers/conda-notice.txt"
32+
mkdir -p "$HOME/.config/vscode-dev-containers"
33+
((sleep 10s; touch "$HOME/.config/vscode-dev-containers/conda-notice-already-displayed") &)
34+
fi
35+
EOF
36+
)"
37+
38+
echo "${notice_script}" | tee -a /etc/bash.bashrc >> /etc/zsh/zshrc

containers/codespaces-linux/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
| *Works in Codespaces* | Yes |
1515
| *Container host OS support* | Linux, macOS, Windows |
1616
| *Container OS* | Ubuntu |
17-
| *Languages, platforms* | Python, Node.js, JavaScript, TypeScript, C++, Java, C#, F#, .NET Core, PHP, PowerShell, Go, Ruby, Rust |
17+
| *Languages, platforms* | Python, Node.js, JavaScript, TypeScript, C++, Java, C#, F#, .NET Core, PHP, PowerShell, Go, Ruby, Rust, Conda |
1818

1919
See **[history](history)** for information on the contents of published images.
2020

@@ -62,11 +62,16 @@ This container also includes a running SSH server that you can use to access the
6262

6363
That's it! Use similar arguments to those in step 5 when executing `scp` or configuring SSHFS.
6464

65+
## Using Conda
66+
This dev container and its associated image includes [the `conda` package manager](https://aka.ms/vscode-remote/conda/about). Additional packages installed using Conda will be downloaded from Anaconda or another repository if you configure one. To reconfigure Conda in this container to access an alternative repository, please see information on [configuring Conda channels here](https://aka.ms/vscode-remote/conda/channel-setup).
67+
68+
Access to the Anaconda repository is covered by the [Anaconda Terms of Service](https://aka.ms/vscode-remote/conda/terms), which may require some organizations to obtain a commercial license from Anaconda. **However**, when this dev container or its associated image is used with GitHub Codespaces or GitHub Actions, **all users are permitted** to use the Anaconda Repository through the service, including organizations normally required by Anaconda to obtain a paid license for commercial activities. Note that third-party packages may be licensed by their publishers in ways that impact your intellectual property, and are used at your own risk.
69+
6570
## Using this definition
6671

6772
While the definition itself works unmodified, you can also directly reference pre-built versions of `.devcontainer/Dockerfile` by using the `image` property in `.devcontainer/devcontainer.json` or updating the `FROM` statement in your own `Dockerfile` to:
6873

69-
`mcr.microsoft.com/vscode/devcontainers/universal:linux`
74+
`mcr.microsoft.com/vscode/devcontainers/universal:1-linux`
7075

7176
Alternatively, you can use the contents of the `Dockerfile` to fully customize your container's contents or to build it for a container host architecture not supported by the image.
7277

containers/codespaces-linux/definition-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"definitionVersion": "1.6.6",
2+
"definitionVersion": "1.6.7",
33
"build": {
44
"latest": true,
55
"rootDistro": "debian",

containers/python-3-anaconda/.devcontainer/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
FROM mcr.microsoft.com/vscode/devcontainers/anaconda:0-3
22

3+
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
4+
ARG NODE_VERSION="none"
5+
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
6+
37
# Copy environment.yml (if found) to a temp location so we update the environment. Also
48
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
59
COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
6-
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
10+
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
711
&& rm -rf /tmp/conda-tmp
812

913
# [Optional] Uncomment this section to install additional OS packages.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Display a notice when not running in GitHub Codespaces
2+
3+
cat << 'EOF' > /usr/local/etc/vscode-dev-containers/conda-notice.txt
4+
When using "conda" from outside of GitHub Codespaces, note the Anaconda repository
5+
contains restrictions on commercial use that may impact certain organizations. See
6+
https://aka.ms/vscode-remote/conda/anaconda
7+
8+
EOF
9+
10+
notice_script="$(cat << 'EOF'
11+
if [ -t 1 ] && [ "${IGNORE_NOTICE}" != "true" ] && [ "${TERM_PROGRAM}" = "vscode" ] && [ "${CODESPACES}" != "true" ] && [ ! -f "$HOME/.config/vscode-dev-containers/conda-notice-already-displayed" ]; then
12+
cat "/usr/local/etc/vscode-dev-containers/conda-notice.txt"
13+
mkdir -p "$HOME/.config/vscode-dev-containers"
14+
((sleep 10s; touch "$HOME/.config/vscode-dev-containers/conda-notice-already-displayed") &)
15+
fi
16+
EOF
17+
)"
18+
19+
echo "${notice_script}" | tee -a /etc/bash.bashrc >> /etc/zsh/zshrc

containers/python-3-anaconda/.devcontainer/base.Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM continuumio/anaconda3
22

33
# Copy library scripts to execute
4-
COPY .devcontainer/library-scripts/*.sh .devcontainer/library-scripts/*.env /tmp/library-scripts/
4+
COPY .devcontainer/library-scripts/*.sh .devcontainer/add-notice.sh .devcontainer/library-scripts/*.env /tmp/library-scripts/
55

66
# [Option] Install zsh
77
ARG INSTALL_ZSH="true"
@@ -13,6 +13,7 @@ ARG USER_UID=1000
1313
ARG USER_GID=$USER_UID
1414
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
1515
&& bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \
16+
&& bash /tmp/library-scripts/add-notice.sh \
1617
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
1718

1819
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
@@ -29,7 +30,7 @@ RUN rm -rf /tmp/library-scripts
2930
# Copy environment.yml (if found) to a temp locaition so we update the environment. Also
3031
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
3132
COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
32-
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
33+
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
3334
&& rm -rf /tmp/conda-tmp
3435

3536
# [Optional] Uncomment this section to install additional OS packages.

containers/python-3-anaconda/.devcontainer/devcontainer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "Anaconda (Python 3)",
3-
"runArgs": ["--init"],
43
"build": {
54
"context": "..",
65
"dockerfile": "Dockerfile",

containers/python-3-anaconda/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
| Metadata | Value |
88
|----------|-------|
99
| *Contributors* | The [VS Code Python extension](https://marketplace.visualstudio.com/itemdetails?itemName=ms-python.python) team |
10-
| *Categories* | Languages |
10+
| *Categories* | Core, Languages |
1111
| *Definition type* | Dockerfile |
1212
| *Published image* | mcr.microsoft.com/vscode/devcontainers/anaconda:3 |
1313
| *Published image architecture(s)* | x86-64, aarch64/arm64 |
@@ -36,6 +36,11 @@ See [history](history) for information on the contents of each version and [here
3636

3737
Alternatively, you can use the contents of `base.Dockerfile` to fully customize your container's contents or to build it for a container host architecture not supported by the image.
3838

39+
### Using Conda
40+
This dev container and its associated image includes [the `conda` package manager](https://aka.ms/vscode-remote/conda/about). Additional packages installed using Conda will be downloaded from Anaconda or another repository if you configure one. To reconfigure Conda in this container to access an alternative repository, please see information on [configuring Conda channels here](https://aka.ms/vscode-remote/conda/channel-setup).
41+
42+
Access to the Anaconda repository is covered by the [Anaconda Terms of Service](https://aka.ms/vscode-remote/conda/terms), which may require some organizations to obtain a commercial license from Anaconda. **However**, when this dev container or its associated image is used with GitHub Codespaces or GitHub Actions, **all users are permitted** to use the Anaconda Repository through the service, including organizations normally required by Anaconda to obtain a paid license for commercial activities. Note that third-party packages may be licensed by their publishers in ways that impact your intellectual property, and are used at your own risk.
43+
3944
#### Debug Configuration
4045

4146
Note that only the integrated terminal is supported by the Remote - Containers extension. You may need to modify `launch.json` configurations to include the following value if an external console is used.

containers/python-3-anaconda/definition-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"definitionVersion": "0.202.0",
2+
"definitionVersion": "0.202.1",
33
"build": {
44
"latest": true,
55
"rootDistro": "debian",

containers/python-3-miniconda/.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/
77
# Copy environment.yml (if found) to a temp location so we update the environment. Also
88
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
99
COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
10-
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
10+
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
1111
&& rm -rf /tmp/conda-tmp
1212

1313
# [Optional] Uncomment to install a different version of Python than the default

0 commit comments

Comments
 (0)