Skip to content

Latest commit

 

History

History
134 lines (88 loc) · 5.84 KB

configure_local_dev_environment.md

File metadata and controls

134 lines (88 loc) · 5.84 KB

Configuring your System for Development Containers


Getting started with development containers

The Visual Studio Code Dev Containers extension lets you use a container as a full-featured development environment. It allows you to open any folder inside (or mounted into) a container and take advantage of Visual Studio Code's full feature set. A devcontainer.json file in your project tells VS Code how to access (or create) a development container with a well-defined tool and runtime stack. This container can be used to run an application or to separate tools, libraries, or runtime needed for working with a codebase.

More information can be found at Developing inside a Container.


Install the Pre-Requisite Software

Install the following software on the machine you will perform the deployment from:

  1. Windows Store Ubuntu 22.04 LTS
  2. Docker Desktop
  3. Visual Studio Code
  4. Remote-Containers VS Code Extension
  5. Git for Windows

Setting up Docker Desktop for Windows with WSL 2

Docker Desktop for Windows provides a development environment for building, shipping, and running dockerized apps. By enabling the WSL 2 based engine, you can run both Linux and Windows containers in Docker Desktop on the same machine.

Configure WSL2 Backend for Docker Containers

To enable Developing inside a Container you must configure the integration between Docker Desktop and Ubuntu on your machine.

  1. Launch Docker Desktop
  2. Open Settings > General. Make sure the *Use the WSL 2 based engine" is enabled.
  3. Navigate to Settings > Resources > WSL INTEGRATION.
    • Ensure *Enable Integration with my default WSL distro" is enabled.
    • Enable the Ubuntu-22.04 option.
  4. Select Apply & Restart

Connect to Ubuntu WSL with VSCode

Now that Docker Desktop and Ubuntu are integrated, we want to Access the Ubuntu bash prompt from inside VSCode.

  1. Launch VSCode.
  2. Select View > Terminal. A new window should open along the bottom of the VSCode window.
  3. From this windows use the Launch Profile dropdown to open the Ubuntu 22.04 (WSL) terminal. image
  4. A bash prompt should open in the format {username}@{machine_name}:/mnt/c/Users/{username}$

Once this is complete, you are ready to configure Git for your Ubuntu WSL environment.

Configure Git in Ubuntu WSL environment

The next step is to configure Git for your Ubuntu WSL environment. We will use the bash prompt from the previous step to issue the following commands:

Set Git User Name and Email

    git config --global user.name "Your Name"
    git config --global user.email "youremail@yourdomain.com"

Set Git UseHttps

    git config --global credential.useHttpPath true

Configure Git to use the Windows Host Credential Manager

git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager-core.exe"

Install Azure CLI On WSL

In your Ubuntu 22.04(WSL) terminal from the previous step, follow the directions here to install Azure CLI.


Configure Local Development Environment

Follow these steps to get the accelerator up and running in a subscription of your choice.

Clone Repo

The first step will be to clone the Git repo into your Ubuntu 18.04 WSL environment and, for production deployments, checkout the version that you would like to deploy. For development, stay on main and checkout an appropriate branch. To do this:

  1. In GitHub, on the Source Tab select <> Code and get the HTTPS Clone path.
  2. Launch VSCode. Open the Ubuntu 22.04(WSL) Terminal.
  3. Run the following command from the bash command prompt
    git clone <repo url> info-assist
    cd info-assist
    git fetch --tags
    git checkout tags/<version>

This will now have created the info-assist folder on your Ubuntu 22.04 WSL environment.


Open Code in Development Container

The next step is to open the source code and build the dev container. To do this you will:

  1. Log into Azure using the Azure CLI
  2. Open the cloned source code into VSCode
  3. Launch and connect to the development container from VSCode

Important: Rebuild Development container

When using any new version of Info Assistant code base from the repo, be sure to rebuild your development container.

A new popup should appear in VS Code to rebuild the container. If the popup does not appear you can also do the following:

  • Control + Shift + P
  • Type Rebuild and select "Dev Containers: Rebuild Container"

This step is complete, please continue on to the next step Configuring your Development Environment for PS Info Assistant section and complete the next step.