-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
180 lines (145 loc) · 6.87 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
FROM debian:10
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
# Utility versions
# The version of Node JS to install
ARG NODE_VERSION=12.x
# The version of Go Lang install found at https://golang.org/dl/
ARG GO_VERSION=1.18.1
# Docker Compose version may be found at https://github.com/docker/compose/releases
ARG COMPOSE_VERSION=2.5.0
# Latest version of Terraform may be found at https://www.terraform.io/downloads.html
ARG TERRAFORM_VERSION=1.1.9
# Latest version of Terrform Linter may be found at https://github.com/terraform-linters/tflint/releases
ARG TFLINT_VERSION=0.35.0
# Latest version of helm may be found at https://github.com/helm/helm/releases
ARG HELM_VERSION=3.8.2
# Linkerd may be found at https://github.com/linkerd/linkerd2/releases
ARG LINKERD_CLI_VERSION=stable-2.11.2
# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser"
# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs
# will be updated to match your local UID/GID (when using the dockerFile property).
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Create a temp directory for downloads
RUN mkdir -p /tmp/downloads
# Configure apt and install generic packages
RUN apt-get update \
&& apt-get install -y --no-install-recommends apt-utils dialog 2>&1 \
#
# Verify git, process tools installed
&& apt-get install -y \
git \
openssh-client \
iproute2 \
curl \
procps \
unzip \
apt-transport-https \
ca-certificates \
gnupg-agent \
software-properties-common \
gnupg2 \
python3-pip \
squashfs-tools \
jq \
lsb-release 2>&1
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
# [Optional] Add sudo support for the non-root user
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
&& chmod 0440 /etc/sudoers.d/$USERNAME
# Install Go
RUN curl -sSL -o /tmp/downloads/golang.tar.gz https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz \
&& tar -C /usr/local -xzf /tmp/downloads/golang.tar.gz
ENV PATH=$PATH:/usr/local/go/bin
# Install Docker CE CLI
RUN apt-get update \
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - 2>/dev/null \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \
&& apt-get update \
&& apt-get install -y docker-ce-cli
# Install Docker Compose
RUN curl -sSL "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/docker-compose
# Node JS
RUN curl -sL https://deb.nodesource.com/setup_${NODE_VERSION} | bash - \
&& apt-get update \
&& apt-get install -y nodejs
# Install some NPM packages
RUN npm install -g \
@vue/cli \
@angular/cli \
typescript
# Install the Azure CLI
RUN 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
# Install Bicep
RUN az bicep install
# Install Terraform, tflint, and graphviz
RUN curl -sSL -o /tmp/downloads/terraform.zip https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip \
&& unzip /tmp/downloads/terraform.zip \
&& mv terraform /usr/local/bin \
&& curl -sSL -o /tmp/downloads/tflint.zip https://github.com/terraform-linters/tflint/releases/download/v${TFLINT_VERSION}/tflint_linux_amd64.zip \
&& unzip /tmp/downloads/tflint.zip \
&& mv tflint /usr/local/bin \
&& cd ~ \
&& apt-get install -y graphviz
# Install Kubectl
RUN echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list \
&& curl -sL https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - 2>/dev/null \
&& apt-get update \
&& apt-get install -y kubectl
# Install Helm
RUN curl -sSL -o /tmp/downloads/helm.tar.gz https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz \
&& mkdir -p /tmp/downloads/helm \
&& tar -C /tmp/downloads/helm -zxvf /tmp/downloads/helm.tar.gz \
&& mv /tmp/downloads/helm/linux-amd64/helm /usr/local/bin \
&& helm repo add stable https://charts.helm.sh/stable/
# Install .NET Core 3.1 and .NET 5.0
ENV \
# Enable detection of running in a container
DOTNET_RUNNING_IN_CONTAINER=true \
# Enable correct mode for dotnet watch (only mode supported in a container)
DOTNET_USE_POLLING_FILE_WATCHER=true \
# Skip extraction of XML docs - generally not useful within an image/container - helps performance
NUGET_XMLDOC_MODE=skip
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-buster-prod buster main" > /etc/apt/sources.list.d/microsoft.list \
&& apt-get update \
&& apt-get install -y \
dotnet-sdk-3.1 \
dotnet-sdk-5.0
# Install Dapr CLI
RUN curl -sL https://raw.githubusercontent.com/dapr/cli/master/install/install.sh | /bin/bash
# Install Azure Functions Core Tools v3 and Static Web Apps CLI
RUN npm install -g \
azure-functions-core-tools@3 --unsafe-perm true \
@azure/static-web-apps-cli
# Install FluxCD 2.x
run curl -s https://fluxcd.io/install.sh | sudo bash
# Install Kustomize
run cd /usr/local/bin \
&& curl -s https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh | bash
# Install Linkerd
RUN curl -s -L https://github.com/linkerd/linkerd2/releases/download/${LINKERD_CLI_VERSION}/linkerd2-cli-${LINKERD_CLI_VERSION}-linux -o /usr/local/bin/linkerd \
&& chmod +x /usr/local/bin/linkerd
# Install GitHub CLI
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh
# Install GoLang and Powerline for the bash shell
RUN go install github.com/justjanne/powerline-go@latest
# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/downloads
# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=dialog