Skip to content

Commit

Permalink
Merge pull request #73526 from dibarbet/net9_devcontainer
Browse files Browse the repository at this point in the history
Install SDK in devcontainer based on global.json
  • Loading branch information
dibarbet authored May 17, 2024
2 parents 4251de7 + 13e7294 commit f51cb52
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 15 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.192.0/containers/dotnet/.devcontainer/base.Dockerfile

FROM mcr.microsoft.com/vscode/devcontainers/dotnet:8.0
FROM mcr.microsoft.com/dotnet/sdk:8.0

ARG DOTNET_SDK_INSTALL_URL=https://dot.net/v1/dotnet-install.sh
# Install the correct Roslyn SDK into the same directory that the base image installs the SDK in.
ENV DOTNET_INSTALL_DIR=/usr/share/dotnet

# Copy the global.json file so its available in the image before the repo is cloned
COPY global.json /tmp/

RUN cd /tmp \
&& curl --location --output dotnet-install.sh "${DOTNET_SDK_INSTALL_URL}" \
&& chmod +x dotnet-install.sh \
&& mkdir -p "${DOTNET_INSTALL_DIR}" \
&& ./dotnet-install.sh --jsonfile "./global.json" --install-dir "${DOTNET_INSTALL_DIR}" \
&& rm dotnet-install.sh

# Set up machine requirements to build the repo
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/dotnetcore
{
"name": "C# (.NET 8)",
"name": "C# (.NET 9)",
"build": {
"dockerfile": "Dockerfile",
// Set the context to the workspace folder to allow us to copy files from it.
"context": ".."
},
"customizations": {
"vscode": {
Expand Down

0 comments on commit f51cb52

Please sign in to comment.