├── Dockerfile ├── README.md ├── devcon.png └── zshrc /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:noble 2 | 3 | # Installing required packages 4 | RUN apt-get update -y 5 | RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ 6 | gnupg \ 7 | build-essential \ 8 | vim \ 9 | git \ 10 | curl \ 11 | cmake \ 12 | wget \ 13 | sudo \ 14 | iputils-ping \ 15 | ssh \ 16 | ansible \ 17 | netcat-traditional \ 18 | python3-setuptools \ 19 | python3-pip \ 20 | zip \ 21 | unzip \ 22 | jq \ 23 | tree \ 24 | maven \ 25 | locate \ 26 | rsync \ 27 | bash-completion \ 28 | apt-transport-https \ 29 | dnsutils \ 30 | software-properties-common \ 31 | ca-certificates \ 32 | zsh \ 33 | fonts-powerline \ 34 | iproute2 \ 35 | file \ 36 | graphviz \ 37 | pipx \ 38 | less \ 39 | postgresql \ 40 | httpie \ 41 | nodejs \ 42 | npm \ 43 | postgresql-contrib \ 44 | redis \ 45 | && rm -rf /var/lib/apt/lists/* 46 | 47 | # Setting up GOPATH. For me, i'm using $HOME/code/go 48 | ENV HOME=/root 49 | ENV GOPATH=$HOME/code/go 50 | ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH:$HOME/.local/bin 51 | 52 | # Package Versions 53 | ENV GOLANG_VERSION=1.23.1 54 | ENV GOLANG_DOWNLOAD_SHA256=faec7f7f8ae53fda0f3d408f52182d942cc89ef5b7d3d9f23ff117437d4b2d2f 55 | ENV TERRAFORM_VERSION=1.12.1 56 | ENV TERRAFORM_STACKS_VERSION=0.6.1 57 | ENV VAULT_VERSION=1.19.2 58 | ENV CONSUL_VERSION=1.20.1 59 | ENV PACKER_VERSION=1.12.0 60 | ENV BOUNDARY_VERSION=0.18.2 61 | ENV WAYPOINT_VERSION=0.11.4 62 | ENV HCDIAG_VERSION=0.5.1 63 | ENV HCDIAG_EXT_VERSION=0.5.0 64 | ENV KUBECTL_VER=1.33.0 65 | ENV HELM_VERSION=3.14.4 66 | ENV CALICO_VERSION=3.16.1 67 | ENV COSIGN_VERSION=1.8.0 68 | ENV INFRACOST_VERSION=0.10.28 69 | 70 | # Installaing Docker CLI & Docker Compose 71 | RUN install -m 0755 -d /etc/apt/keyrings && \ 72 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \ 73 | echo "deb [arch=arm64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \ 74 | apt-get update && apt-get -y install docker-ce-cli docker-compose-plugin 75 | 76 | # Installing + Setting Up GO Environment 77 | ENV GOLANG_DOWNLOAD_URL=https://golang.org/dl/go$GOLANG_VERSION.linux-arm64.tar.gz 78 | RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \ 79 | && echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \ 80 | && sudo tar -C /usr/local -xzf golang.tar.gz \ 81 | && rm golang.tar.gz 82 | 83 | # Installing HashiCorp Stack 84 | # Installing Terraform 85 | RUN curl https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_arm64.zip -o terraform.zip 86 | RUN unzip -o terraform.zip -d /usr/local/bin 87 | RUN rm terraform.zip 88 | 89 | # Installing Terraform Stacks 90 | RUN curl https://releases.hashicorp.com/tfstacks/${TERRAFORM_STACKS_VERSION}/tfstacks_${TERRAFORM_STACKS_VERSION}_linux_arm64.zip -o tfstacks.zip 91 | RUN unzip -o tfstacks.zip -d /usr/local/bin 92 | RUN rm tfstacks.zip 93 | 94 | # Installing Vault 95 | RUN curl https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_arm64.zip -o vault.zip 96 | RUN unzip -o vault.zip -d /usr/local/bin 97 | RUN rm vault.zip 98 | 99 | # Installing Packer 100 | RUN curl https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_arm64.zip -o packer.zip 101 | RUN unzip -o packer.zip -d /usr/local/bin 102 | RUN rm packer.zip 103 | 104 | # Installing Boundary 105 | RUN curl https://releases.hashicorp.com/boundary/${BOUNDARY_VERSION}/boundary_${BOUNDARY_VERSION}_linux_arm64.zip -o boundary.zip 106 | RUN unzip -o boundary.zip -d /usr/local/bin 107 | RUN rm boundary.zip 108 | 109 | # Installing Consul 110 | RUN curl https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_arm64.zip -o consul.zip 111 | RUN unzip -o consul.zip -d /usr/local/bin 112 | RUN rm consul.zip 113 | 114 | # Installing Waypoint 115 | RUN curl -fsSl https://releases.hashicorp.com/waypoint/${WAYPOINT_VERSION}/waypoint_${WAYPOINT_VERSION}_linux_arm64.zip -o waypoint.zip 116 | RUN unzip -o waypoint.zip -d /usr/local/bin 117 | RUN rm waypoint.zip 118 | 119 | # Installing hcdiag / hcdiag-ext 120 | RUN curl -fsSl https://releases.hashicorp.com/hcdiag/${HCDIAG_VERSION}/hcdiag_${HCDIAG_VERSION}_linux_arm64.zip -o hcdiag.zip 121 | RUN unzip hcdiag.zip -d /usr/local/bin 122 | RUN rm hcdiag.zip 123 | RUN curl -Lk https://github.com/hashicorp/hcdiag-ext/archive/refs/tags/v${HCDIAG_EXT_VERSION}.zip -o hcdiag-ext-${HCDIAG_EXT_VERSION}.zip 124 | RUN unzip hcdiag-ext-${HCDIAG_EXT_VERSION}.zip -d /usr/local/bin 125 | RUN rm hcdiag-ext-${HCDIAG_EXT_VERSION}.zip 126 | 127 | # Install netshoot kubcetl plugin 128 | RUN go install github.com/nilic/kubectl-netshoot@latest 129 | 130 | # Installing ccat (https://github.com/jingweno/ccat) 131 | RUN go install github.com/jingweno/ccat@latest 132 | # Installing CFSSL (https://github.com/cloudflare/cfssl) 133 | RUN go install github.com/cloudflare/cfssl/cmd/cfssl@latest 134 | 135 | # Kubernetes Tools : kubectl, kubectx, and kubens 136 | RUN wget https://raw.githubusercontent.com/ahmetb/kubectx/master/kubectx -O /usr/local/bin/kubectx && chmod +x /usr/local/bin/kubectx 137 | RUN wget https://raw.githubusercontent.com/ahmetb/kubectx/master/kubens -O /usr/local/bin/kubens && chmod +x /usr/local/bin/kubens 138 | RUN wget https://dl.k8s.io/release/v$KUBECTL_VER/bin/linux/arm64/kubectl -O /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl 139 | 140 | # Installing Helm 141 | RUN wget https://get.helm.sh/helm-v$HELM_VERSION-linux-arm64.tar.gz -O /tmp/helm-v$HELM_VERSION-linux-arm64.tar.gz && \ 142 | tar -zxvf /tmp/helm-v$HELM_VERSION-linux-arm64.tar.gz && \ 143 | mv linux-arm64/helm /usr/local/bin/helm && \ 144 | chmod +x /usr/local/bin/helm 145 | 146 | # Installing Krew 147 | RUN OS="$(uname | tr '[:upper:]' '[:lower:]')" && \ 148 | ARCH="$(uname -m | sed -e 's/x86_64/arm4/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" && \ 149 | KREW="krew-${OS}_${ARCH}" && \ 150 | curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" && \ 151 | tar zxvf ${KREW}.tar.gz && \ 152 | KREW=./krew-"${OS}_${ARCH}" && \ 153 | "$KREW" install krew && \ 154 | cp $HOME/.krew/bin/kubectl-krew /usr/local/bin/ 155 | # Installing eksctl 156 | RUN curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_arm64.tar.gz" | tar xz -C /tmp && \ 157 | mv /tmp/eksctl /usr/local/bin 158 | 159 | # Installing gcloud sdk 160 | RUN wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-arm.tar.gz -O /tmp/google-cloud-cli-linux-arm.tar.gz && \ 161 | tar -zxvf /tmp/google-cloud-cli-linux-arm.tar.gz 162 | ENV PATH=$PATH:$HOME/google-cloud-sdk/bin 163 | 164 | 165 | # Installing Azure CLI 166 | RUN curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash 167 | 168 | # Installing Sigstore Cosign (https://github.com/sigstore/cosign) 169 | RUN wget https://github.com/sigstore/cosign/releases/download/v${COSIGN_VERSION}/cosign-linux-arm64 -O /usr/local/bin/cosign && chmod +x /usr/local/bin/cosign 170 | 171 | # Installing Snyk CLI 172 | RUN curl https://static.snyk.io/cli/latest/snyk-linux -o /usr/local/bin/snyk && chmod +x /usr/local/bin/snyk 173 | 174 | # Installing AWS CLI v2 + Session Manager + IAM Authenticator 175 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip" && \ 176 | unzip awscliv2.zip && \ 177 | sudo ./aws/install 178 | RUN curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_arm64/session-manager-plugin.deb" -o "session-manager-plugin.deb" && dpkg -i session-manager-plugin.deb 179 | RUN curl "https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.5.9/aws-iam-authenticator_0.5.9_linux_arm64" -o /usr/local/bin/aws-iam-authenticator && chmod +x /usr/local/bin/aws-iam-authenticator 180 | 181 | # Installing Infracost CLI 182 | RUN wget https://github.com/infracost/infracost/releases/download/v${INFRACOST_VERSION}/infracost-linux-arm64.tar.gz 183 | RUN tar xzf infracost-linux-arm64.tar.gz -C /tmp 184 | RUN mv /tmp/infracost-linux-arm64 /usr/local/bin/infracost 185 | 186 | # Installing Github CLI 187 | RUN sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 188 | RUN sudo apt-add-repository https://cli.github.com/packages 189 | RUN sudo apt install gh 190 | 191 | # Setting WORKDIR and USER 192 | USER root 193 | WORKDIR /root 194 | VOLUME ["/home/devcon"] 195 | 196 | # ZSH ENVs 197 | ENV TERM=xterm 198 | ENV ZSH_THEME=agnoster 199 | RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true 200 | RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions 201 | RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k 202 | COPY zshrc .zshrc 203 | 204 | # Running ZSH 205 | CMD ["zsh"] 206 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## DEVCON: a Complete Dev Environment in a Container 📦 2 | 3 | **Development Container Blog Post:** [link](https://medium.com/@nicolakabar/the-ultimate-development-environment-moving-from-vagrant-to-docker-for-mac-532bcf07e186) 4 | 5 | As a rule of thumb, I never install any packages directly onto my Mac unless I absolutely have to. So I created this sample development container that I use with Docker for Mac to be my sole dev environment. There is a breakdown in the Dockerfile of which tools are installed. 6 | 7 | 8 | ### Package Versions 9 | ``` 10 | ENV GOLANG_VERSION 1.20.3 11 | ENV GOLANG_DOWNLOAD_SHA256 eb186529f13f901e7a2c4438a05c2cd90d74706aaa0a888469b2a4a617b6ee54 12 | ENV TERRAFORM_VERSION 1.6.6 13 | ENV VAULT_VERSION 1.15.4 14 | ENV CONSUL_VERSION 1.16.0 15 | ENV PACKER_VERSION 1.10.0 16 | ENV BOUNDARY_VERSION 0.14.3 17 | ENV WAYPOINT_VERSION 0.11.4 18 | ENV HCDIAG_VERSION 0.5.1 19 | ENV HCDIAG_EXT_VERSION 0.5.0 20 | ENV KUBECTL_VER 1.27.1 21 | ENV HELM_VERSION 3.12.0 22 | ENV CALICO_VERSION 3.16.1 23 | ENV COSIGN_VERSION 1.8.0 24 | ENV INFRACOST_VERSION 0.10.28 25 | ``` 26 | ### Usage 27 | 28 | ``` 29 | $ docker run -it --rm --hostname devcon -v /var/run/docker.sock:/var/run/docker.sock nicolaka/devcon:latest 30 | ``` 31 | 32 | ![img](devcon.png) 33 | 34 | Optionally, you can mount your local Mac dev directory inside the container by adding `-v /path/to/dir:/root`. Typically, I mount a specific dev directory from my Mac that contains my dot files (including git, ssh config + keys) to make it easier to use across both Mac and within the dev container. This way I can make sure that the dev container is a throw-away, leaving no keys/secrets exposed or written in it. 35 | 36 | Feel free to use and adjust to fit your own dev tooling! 37 | 38 | Cheers 🍺 39 | 40 | 41 | -------------------------------------------------------------------------------- /devcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolaka/devcon/a605428752b826da640073e178b700e765135c78/devcon.png -------------------------------------------------------------------------------- /zshrc: -------------------------------------------------------------------------------- 1 | # If you come from bash you might have to change your $PATH. 2 | # export PATH=$HOME/bin:/usr/local/bin:$PATH 3 | 4 | # Path to your oh-my-zsh installation. 5 | export ZSH=$HOME/.oh-my-zsh 6 | 7 | # Set name of the theme to load. Optionally, if you set this to "random" 8 | # it'll load a random theme each time that oh-my-zsh is loaded. 9 | # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes 10 | #export TERM="xterm-256color" 11 | ZSH_THEME="powerlevel10k/powerlevel10k" 12 | 13 | # Set list of themes to load 14 | # Setting this variable when ZSH_THEME=random 15 | # cause zsh load theme from this variable instead of 16 | # looking in ~/.oh-my-zsh/themes/ 17 | # An empty array have no effect 18 | # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) 19 | 20 | # Uncomment the following line to use case-sensitive completion. 21 | # CASE_SENSITIVE="true" 22 | 23 | # Uncomment the following line to use hyphen-insensitive completion. Case 24 | # sensitive completion must be off. _ and - will be interchangeable. 25 | # HYPHEN_INSENSITIVE="true" 26 | 27 | # Uncomment the following line to disable bi-weekly auto-update checks. 28 | # DISABLE_AUTO_UPDATE="true" 29 | 30 | # Uncomment the following line to change how often to auto-update (in days). 31 | # export UPDATE_ZSH_DAYS=13 32 | 33 | # Uncomment the following line to disable colors in ls. 34 | # DISABLE_LS_COLORS="true" 35 | 36 | # Uncomment the following line to disable auto-setting terminal title. 37 | # DISABLE_AUTO_TITLE="true" 38 | 39 | # Uncomment the following line to enable command auto-correction. 40 | # ENABLE_CORRECTION="true" 41 | 42 | # Uncomment the following line to display red dots whilst waiting for completion. 43 | # COMPLETION_WAITING_DOTS="true" 44 | 45 | # Uncomment the following line if you want to disable marking untracked files 46 | # under VCS as dirty. This makes repository status check for large repositories 47 | # much, much faster. 48 | # DISABLE_UNTRACKED_FILES_DIRTY="true" 49 | 50 | # Uncomment the following line if you want to change the command execution time 51 | # stamp shown in the history command output. 52 | # The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" 53 | # HIST_STAMPS="mm/dd/yyyy" 54 | 55 | # Would you like to use another custom folder than $ZSH/custom? 56 | # ZSH_CUSTOM=/path/to/new-custom-folder 57 | 58 | # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) 59 | # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ 60 | # Example format: plugins=(rails git textmate ruby lighthouse) 61 | # Add wisely, as too many plugins slow down shell startup. 62 | plugins=( 63 | git 64 | zsh-autosuggestions 65 | yarn 66 | web-search 67 | jsontools 68 | macports 69 | node 70 | osx 71 | sudo 72 | docker 73 | ) 74 | 75 | source $ZSH/oh-my-zsh.sh 76 | 77 | # User configuration 78 | 79 | 80 | # export MANPATH="/usr/local/man:$MANPATH" 81 | 82 | # You may need to manually set your language environment 83 | # export LANG=en_US.UTF-8 84 | 85 | # Preferred editor for local and remote sessions 86 | # if [[ -n $SSH_CONNECTION ]]; then 87 | # export EDITOR='vim' 88 | # else 89 | # export EDITOR='mvim' 90 | # fi 91 | 92 | # Compilation flags 93 | # export ARCHFLAGS="-arch x86_64" 94 | 95 | # ssh 96 | # export SSH_KEY_PATH="~/.ssh/rsa_id" 97 | 98 | # Set personal aliases, overriding those provided by oh-my-zsh libs, 99 | # plugins, and themes. Aliases can be placed here, though oh-my-zsh 100 | # users are encouraged to define aliases within the ZSH_CUSTOM folder. 101 | # For a full list of active aliases, run `alias`. 102 | # 103 | # Example aliases 104 | # alias zshconfig="mate ~/.zshrc" 105 | # alias ohmyzsh="mate ~/.oh-my-zsh" 106 | 107 | # test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" 108 | 109 | # Reload the plugin to highlight the commands each time Iterm2 starts 110 | #source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 111 | 112 | 113 | ### VISUAL CUSTOMISATION ### 114 | 115 | # Elements options of left prompt (remove the @username context) 116 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(host dir rbenv vcs) 117 | # Elements options of right prompt 118 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time) 119 | 120 | 121 | 122 | # Add a second prompt line for the command 123 | POWERLEVEL9K_PROMPT_ON_NEWLINE=false 124 | 125 | # Add a space in the first prompt 126 | POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="%f" 127 | 128 | # Visual customisation of the second prompt line 129 | #local user_symbol="$" 130 | #if [[ $(print -P "%#") =~ "#" ]]; then 131 | # user_symbol = "#" 132 | #fi 133 | #POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%{%B%F{black}%K{yellow}%} $user_symbol%{%b%f%k%F{yellow}%} %{%f%}" 134 | 135 | 136 | # Change the git status to red when something isn't committed and pushed 137 | POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='red' 138 | 139 | # Add a new line after the global prompt 140 | POWERLEVEL9K_PROMPT_ADD_NEWLINE=true 141 | 142 | 143 | # Colorise the top Tabs of Iterm2 with the same color as background 144 | # Just change the 18/26/33 wich are the rgb values 145 | echo -e "\033]6;1;bg;red;brightness;18\a" 146 | echo -e "\033]6;1;bg;green;brightness;26\a" 147 | echo -e "\033]6;1;bg;blue;brightness;33\a" 148 | --------------------------------------------------------------------------------