chore: setup dev-container

This commit is contained in:
Nogic 2022-10-18 05:21:36 +00:00
parent 4d4a70f4a5
commit cb9c083494
2 changed files with 50 additions and 0 deletions

24
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,24 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/dotnet/.devcontainer/base.Dockerfile
# [Choice] .NET version: 6.0, 3.1, 6.0-bullseye, 3.1-bullseye, 6.0-focal, 3.1-focal
ARG VARIANT="6.0-bullseye-slim"
FROM mcr.microsoft.com/devcontainers/dotnet:0-${VARIANT}
# [Choice] Node.js version: none, lts/*, 18, 16, 14
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends cmake pkg-config \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install licensed
ARG LICENSED_VERSION="3.7.4"
RUN curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/${LICENSED_VERSION}/licensed-${LICENSED_VERSION}-linux-x64.tar.gz \
&& tar -xzf licensed.tar.gz \
&& mv licensed /usr/local/bin/licensed
# [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

View File

@ -0,0 +1,26 @@
// 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.245.2/containers/dotnet
{
"name": "C# (.NET)",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "6.0",
"NODE_VERSION": "16"
}
},
"customizations": {
"vscode": {
"extensions": [
"esbenp.prettier-vscode",
"ms-dotnettools.csharp",
"ms-vscode.powershell"
]
}
},
"features": {
"powershell": "latest"
},
"remoteUser": "vscode",
"postCreateCommand": "dotnet restore ./__tests__/sample-csproj"
}