diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000000..39dc967e94c5 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,66 @@ +#------------------------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. +#------------------------------------------------------------------------------------------------------------- + +# 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 unoplatform/wasm-build:2.2 + +# This Dockerfile adds a non-root user with sudo access. Update the “remoteUser” property in +# devcontainer.json to use it. More info: https://aka.ms/vscode-remote/containers/non-root-user. +ARG USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# Options for common setup script +ARG INSTALL_ZSH="true" +ARG UPGRADE_PACKAGES="true" +ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/script-library/common-debian.sh" +ARG COMMON_SCRIPT_SHA="dev-mode" + +# [Optional] Settings for installing Node.js. +ARG INSTALL_NODE="true" +ARG NODE_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/script-library/node-debian.sh" +ARG NODE_SCRIPT_SHA="dev-mode" +ARG NODE_VERSION="lts/*" +ENV NVM_DIR=/usr/local/share/nvm +ENV NVM_SYMLINK_CURRENT=true +ENV PATH=${NVM_DIR}/current/bin:${PATH} + +# [Optional] Install the Azure CLI +ARG INSTALL_AZURE_CLI="false" + +# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies. +RUN apt-get update \ + && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \ + && curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \ + && ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/common-setup.sh" | sha256sum -c -)) \ + && /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \ + # + # [Optional] Install Node.js for ASP.NET Core Web Applicationss + && if [ "$INSTALL_NODE" = "true" ]; then \ + curl -sSL ${NODE_SCRIPT_SOURCE} -o /tmp/node-setup.sh \ + && ([ "${NODE_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/node-setup.sh" | sha256sum -c -)) \ + && /bin/bash /tmp/node-setup.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}"; \ + fi \ + # + # [Optional] Install the Azure CLI + && 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; \ + fi \ + # + # Clean up + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -f /tmp/common-setup.sh /tmp/node-setup.sh \ + && rm -rf /var/lib/apt/lists/* + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update \ +# && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000000..86db863aed52 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,52 @@ +{ + "name": "Uno Platform", + "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", + // Options + "INSTALL_NODE": "true", + "NODE_VERSION": "lts/*", + "INSTALL_AZURE_CLI": "false", + "UPGRADE_PACKAGES": "false" + } + }, + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-dotnettools.csharp" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ 8000, 53487 ], + + // [Optional] To reuse of your local HTTPS dev cert, first export it locally using this command: + // * Windows PowerShell: + // dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere" + // * macOS/Linux terminal: + // dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere" + // + // Next, after running the command above, uncomment lines in the 'mounts' and 'remoteEnv' lines below, + // and open / rebuild the container so the settings take effect. + // + "mounts": [ + // "source=${env:HOME}${env:USERPROFILE}/.aspnet/https,target=/home/vscode/.aspnet/https,type=bind" + ], + "remoteEnv": { + // "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere", + // "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx", + } + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "dotnet restore", + + // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. + // "remoteUser": "vscode" +} diff --git a/.gitignore b/.gitignore index f76572bc047c..f056b5365a8b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ # Remove everything beginning with a dot .*/ !.github/ +!.devcontainer/ # operating system junk files thumbs.db