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

Commit

Permalink
Switch F# to use pre-built image (CI Ignore)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuxel committed Aug 18, 2020
1 parent b30fa20 commit 9c48557
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 38 deletions.
41 changes: 9 additions & 32 deletions containers/dotnetcore-fsharp/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,43 +1,20 @@
# Update the VARIANT arg in devcontainer.json to pick a .NET Core version: 3.1-bionic, 2.1-bionic
ARG VARIANT="3.1-bionic"
FROM mcr.microsoft.com/dotnet/core/sdk:${VARIANT}
ARG VARIANT=3.1
FROM mcr.microsoft.com/vscode/devcontainers/dotnetcore:dev-${VARIANT}

# Options for setup script
ARG INSTALL_ZSH="true"
ARG UPGRADE_PACKAGES="false"
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
COPY library-scripts/common-debian.sh /tmp/library-scripts/
RUN apt-get update \
&& /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/library-scripts

# [Optional] Install Node.js for use with web applications - update the INSTALL_NODE arg in devcontainer.json to enable.
ARG INSTALL_NODE="false"
# [Optional] Install a version of Node.js using nvm for front end dev
ARG INSTALL_NODE="true"
ARG NODE_VERSION="lts/*"
ENV NVM_DIR=/usr/local/share/nvm
ENV NVM_SYMLINK_CURRENT=true \
PATH=${NVM_DIR}/current/bin:${PATH}
COPY library-scripts/node-debian.sh /tmp/library-scripts/
RUN if [ "$INSTALL_NODE" = "true" ]; then /bin/bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}"; fi \
&& rm -rf /var/lib/apt/lists/* /tmp/library-scripts
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

# [Optional] Install the Azure CLI - update the INSTALL_AZURE_CLI arg in devcontainer.json to enable.
ARG INSTALL_AZURE_CLI="false"
RUN if [ "$INSTALL_AZURE_CLI" = "true" ]; then \
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \
&& apt-get update \
&& apt-get install -y azure-cli \
&& rm -rf /var/lib/apt/lists/*; \
fi
COPY library-scripts/azcli-debian.sh /tmp/library-scripts/
RUN if [ "$INSTALL_AZURE_CLI" = "true" ]; then bash /tmp/library-scripts/azcli-debian.sh; fi \
&& rm -rf /var/lib/apt/lists/* /tmp/library-scripts

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
5 changes: 2 additions & 3 deletions containers/dotnetcore-fsharp/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update 'VARIANT' to pick a .NET Core version. Rebuild the container if
// it already exists to update. Example variants: 2.1-bionic, 3.1-bionic
"VARIANT": "3.1-bionic",
// Update 'VARIANT' to pick a .NET Core version: 2.1, 3.1
"VARIANT": "3.1",
// Options
"INSTALL_NODE": "false",
"NODE_VERSION": "lts/*",
Expand Down
21 changes: 18 additions & 3 deletions containers/dotnetcore-fsharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,34 @@
|----------|-------|
| *Contributors* | The VS Code Team, F# team |
| *Definition type* | Dockerfile |
| *Published images* | mcr.microsoft.com/vscode/devcontainers/dotnetcore |
| *Available image variants* | 2.1, 3.1 |
| *Published image architecture(s)* | x86-64 |
| *Works in Codespaces* | Yes |
| *Container host OS support* | Linux, macOS, Windows |
| *Languages, platforms* | .NET Core, F# |

## Using this definition with an existing folder

While this definition should work unmodified, you can select the version of .NET Core the container uses by updating the `VARIANT` arg in the included `devcontainer.json` (and rebuilding if you've already created the container).
While this definition should work unmodified, you can select the version of .NET Core the container uses by updating the `VARIANT` arg in the included `devcontainer.json` to either 2.1 or 3.1.

```json
"args": { "VARIANT": "3.1-bionic" }
"args": { "VARIANT": "3.1" }
```

In addition there are a number of options that can be set to customize your environment.
You can also directly reference pre-built versions of `.devcontainer/base.Dockerfile` by using the `image` property in `.devcontainer/devcontainer.json` or updating the `FROM` statement in your own `Dockerfile` to one of the following. An example `Dockerfile` is included in this repository.

- `mcr.microsoft.com/vscode/devcontainers/dotnetcore` (latest)
- `mcr.microsoft.com/vscode/devcontainers/dotnetcore:2.1`
- `mcr.microsoft.com/vscode/devcontainers/dotnetcore:3.1`

Version specific tags tied to [releases in this repository](https://github.com/microsoft/vscode-dev-containers/releases) are also available.

- `mcr.microsoft.com/vscode/devcontainers/dotnetcore:0-3.1`
- `mcr.microsoft.com/vscode/devcontainers/dotnetcore:0.135-3.1`
- `mcr.microsoft.com/vscode/devcontainers/dotnetcore:0.135.0-3.1`

Alternatively, you can use the [contents of this `base.Dockerfile`](../dotnetcore/..devcontainer/base.Dockerfile) to fully customize your container's contents or to build it for a container host architecture not supported by the image.

### Debug Configuration

Expand Down

0 comments on commit 9c48557

Please sign in to comment.