Skip to content
This repository was archived by the owner on Jan 28, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------

FROM golang:1.12.5
FROM golang:1.12.5-stretch

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
Expand Down Expand Up @@ -47,7 +47,7 @@ RUN apt-get update \
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update \
# Install Docker CE CLI
Expand All @@ -62,6 +62,9 @@ RUN apt-get update \
# Install Helm
&& curl -s https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash -

# Enable bash completion
RUN apt-get update && apt install -y bash-completion && echo "source /etc/bash_completion" >> "/root/.bashrc"

# Verify git, process tools installed
RUN apt-get -y install git procps wget nano zsh inotify-tools jq
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true
Expand All @@ -84,3 +87,26 @@ RUN make install-kubebuilder
RUN make install-kustomize
RUN make install-test-dependency
ENV SHELL /bin/bash

# Save command line history
RUN echo "export HISTFILE=/root/commandhistory/.bash_history" >> "/root/.bashrc" \
&& echo "export PROMPT_COMMAND='history -a'" >> "/root/.bashrc" \
&& mkdir -p /root/commandhistory \
&& touch /root/commandhistory/.bash_history

# Add useful aliases
RUN echo "alias k=kubectl" >> "/root/.bashrc"
# Add autocomplete to kubectl
RUN echo "source <(kubectl completion bash)" >> "/root/.bashrc"
RUN echo "source <(kubectl completion bash | sed 's/kubectl/k/g')" >> "/root/.bashrc"
# Add kubectx
RUN git clone https://github.com/ahmetb/kubectx.git /root/.kubectx \
&& COMPDIR=$(pkg-config --variable=completionsdir bash-completion) \
&& ln -sf /root/.kubectx/completion/kubens.bash $COMPDIR/kubens \
&& ln -sf /root/.kubectx/completion/kubectx.bash $COMPDIR/kubectx

# Git command prompt
RUN git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt --depth=1 \
&& echo "if [ -f \"$HOME/.bash-git-prompt/gitprompt.sh\" ]; then GIT_PROMPT_ONLY_IN_REPO=1 && source $HOME/.bash-git-prompt/gitprompt.sh; fi" >> "/root/.bashrc"

ENV PATH="/root/.kubectx:${PATH}"
27 changes: 23 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml.
{
"name": "Go",
"dockerComposeFile": "docker-compose.yml",
"service": "docker-in-docker",
"dockerFile": "./Dockerfile",
"workspaceFolder": "/workspace",
"context": "..",
"workspaceMount": "src=${localWorkspaceFolder},dst=/workspace,type=bind",
"postCreateCommand": "make set-kindcluster",
"shutdownAction": "stopCompose",
"runArgs": [
// Mount the env file
"--env-file", "${localWorkspaceFolder}/.devcontainer/.env",
// Mount go mod cache
"-v", "dboperator-gomodcache:/go/pkg",
// Cache vscode exentsions installs and homedir
"-v", "dboperator-vscodecache:/root/.vscode-server",
// Keep command history
"-v", "dboperator-bashhistory:/root/commandhistory",
// Enable security needed for docker
"--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined",
// Mount docker socket for docker builds
"-v", "/var/run/docker.sock:/var/run/docker.sock",
"--network", "host",
"-e GO111MODULE=on",
// Mount azure
"-v", "${env:HOME}${env:USERPROFILE}/.azure:/home/vscode/.azure"
// Optionally mount k8s auth to existing cluster
// "-v", "${env:HOME}${env:USERPROFILE}/.kube:/home/vscode/.kube",
],
"extensions": [
"ms-azuretools.vscode-docker",
"ms-vscode.go"
],
"settings": {
"terminal.integrated.shell.linux": "zsh",
"go.gopath": "/go",
"go.inferGopath": true,
"go.useLanguageServer": true,
Expand Down
22 changes: 0 additions & 22 deletions .devcontainer/docker-compose.yml

This file was deleted.

1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ endif
@echo "deploying controller to cluster"
make deploy-controller


install-kind:
ifeq (,$(shell which kind))
@echo "installing kind"
Expand Down