Skip to content

Latest commit

 

History

History

setup

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

All-in-one container image for running Hangar

As a Developer (Client, Capgemini, Third Party, anyone on the Web) I want to be able to download a single executable so I will be able to run it without an installation process (run the executable directly from the “Downloads” directory if necessary) and have all the CLIs for Azure, AWS & GCloud available.

This solution uses a Dockerfile to create an image with all the required tools ready to use.

Included tools

The following toolkits are included in the solution:

  • AWS

  • Azure

  • GCloud

  • Kubectl

  • Terraform

  • GitHub

  • Firebase CLI

Plus (+) other tools like unzip, git, wget, java & python

How to use

  1. Build the image docker build -t hangar -f ./setup/Dockerfile .

  2. Execute a command inside the image docker run --rm -it hangar gcloud auth login or open an interactive shell docker run --rm -it hangar bash

Warning
The container is stateless — all the information (credentials, configurations, etc.) created inside the session will be lost at the end of the lifecycle of the container.
Tip
If you want to have persistence between executions or map the configuration files from your local host check the next section for mapping volumes.

Running container with persistence

Important
Before mounting the volumes make sure all the folders exist, Rancher will not create them by default.

Windows

Using Rancher Desktop

docker run --rm -it -v /Users/$env:UserName/AppData/Roaming/gcloud:/root/.config/gcloud -v /Users/$env:UserName/AppData/Roaming/configstore:/root/.config/configstore -v /Users/$env:UserName/.aws:/root/.aws -v /Users/$env:UserName/.azure:/root/.azure -v /Users/$env:UserName/.kube:/root/.kube -v "/Users/$env:UserName/AppData/Roaming/GitHub CLI:/root/.config/gh" -v /Users/$env:UserName/.ssh:/root/.ssh -v /Users/$env:UserName/hangar_workspace:/scripts/workspace -v /Users/$env:UserName/.gitconfig:/root/.gitconfig hangar bash

Using Docker Desktop

docker run --rm -it -v C:\Users\$env:UserName\AppData\Roaming\gcloud\:/root/.config/gcloud -v C:\Users\$env:UserName\AppData\Roaming\configstore\:/root/.config/configstore -v C:\Users\$env:UserName\.aws:/root/.aws -v C:\Users\$env:UserName\.azure:/root/.azure -v C:\Users\$env:UserName\.kube:/root/.kube -v "C:\Users\$env:UserName\AppData\Roaming\GitHub CLI:/root/.config/gh" -v C:\Users\$env:UserName\.ssh:/root/.ssh -v C:\Users\$env:UserName\hangar_workspace:/scripts/workspace -v C:\Users\$env:UserName\.gitconfig:/root/.gitconfig hangar bash

Create host paths on Windows

mkdir -p /Users/$env:UserName/AppData/Roaming/gcloud
mkdir -p /Users/$env:UserName/AppData/Roaming/configstore
mkdir -p /Users/$env:UserName/.aws
mkdir -p /Users/$env:UserName/.azure:/root/.azure
mkdir -p /Users/$env:UserName/.kube
mkdir -p "/Users/$env:UserName/AppData/Roaming/GitHub CLI"
mkdir -p /Users/$env:UserName/.ssh
mkdir -p /Users/$env:UserName/hangar_workspace

Linux

docker run --rm -it -v ~/.config/gcloud:/root/.config/gcloud -v ~/.aws:/root/.aws -v ~/.azure:/root/.azure -v ~/.kube:/root/.kube -v ~/.config/gh:/root/.config/gh -v ~/.ssh:/root/.ssh -v ~/hangar_workspace:/scripts/workspace -v ~/.config/configstore:/root/.config/configstore -v ~/.gitconfig:/root/.gitconfig hangar bash

Create host paths on Linux

mkdir -p ~/.config/gcloud
mkdir -p ~/.config/configstore
mkdir -p ~/.aws
mkdir -p ~/.azure
mkdir -p ~/.kube
mkdir -p ~/.config/gh
mkdir -p ~/.ssh
mkdir -p ~/hangar_workspace

Volumes Mapping

Tool Windows Linux Container

GCloud CLI

/Users/$env:UserName/AppData/Roaming/gcloud

~/.config/gcloud

/root/.config/gcloud

AWS CLI

/Users/$env:UserName/.aws

~/.aws

/root/.aws

Azure CLI

/Users/$env:UserName/.azure

~/.azure

/root/.azure

Kubectl CLI

/Users/$env:UserName/.kube

~/.kube

/root/.kube

GitHub CLI

/Users/$env:UserName/AppData/Roaming/GitHub CLI

~/.config/gh

/root/.config/gh

Firebase CLI

/Users/$env:UserName/AppData/Roaming/configstore

~/.config/configstore

/root/.config/configstore

SSH Keys

/Users/$env:UserName/.ssh

~/.ssh

/root/.ssh