-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
Copy pathDockerfile
130 lines (107 loc) · 4.39 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
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This is a Dockerfile for running and building Kubernetes dashboard
# It installs all deps in the container and adds the dashboard source
# This way it abstracts all required build tools away
# golang is based on debian:jessie
# Specify version to clarify which version we use.
FROM golang:1.23-bullseye
# Install Node.js. Go is already installed.
# A small tweak, apt-get update is already run by the nodejs setup script,
# so there's no need to run it again.
RUN apt-get update && apt-get install -y ca-certificates --no-install-recommends curl gnupg
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | \
gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
ENV NODE_MAJOR=20
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | \
tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update && apt-get install -y --no-install-recommends \
nodejs \
patch \
chromium \
bc \
sudo \
git \
gosu \
nano \
less \
xvfb \
libgtk-3-0 \
libgconf-2-4 \
bzip2 \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Install yarn
RUN npm install -g yarn
ENV GIT_EDITOR=nano
# Install firefox from Mozilla binaries
RUN mkdir -p /usr/local/lib/firefox
RUN wget "https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=en-US" -O /tmp/firefox.tar.bz2
RUN tar -xjf /tmp/firefox.tar.bz2 -C /usr/local/lib
RUN ln -s /usr/local/lib/firefox/firefox /usr/local/bin/firefox
# Set environment variable for JavaScript tests.
ENV CHROME_BIN=/usr/bin/chromium
# Set environment variable for terminal
ENV TERM=xterm
# Add ${GOPATH}/bin into ${PATH}
ENV PATH=${GOPATH}/bin:${PATH}
# Suppress angular analytics dialog
ENV NG_CLI_ANALYTICS=false
# Download a statically linked docker client,
# so the container is able to build images on the host.
RUN curl -sSL https://download.docker.com/linux/static/stable/x86_64/docker-25.0.5.tgz > /tmp/docker.tgz && \
cd /tmp/ && \
tar xzvf docker.tgz && \
rm docker.tgz && \
mv /tmp/docker/docker /usr/bin/docker && \
rm -rf /tmp/docker/ && \
chmod +x /usr/bin/docker
# Install docker compose plugin
RUN mkdir -p /usr/local/lib/docker/cli-plugins
RUN curl -SL https://github.com/docker/compose/releases/download/v2.25.0/docker-compose-linux-x86_64 \
-o /usr/local/lib/docker/cli-plugins/docker-compose
RUN chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
# Install kubectl
RUN curl -LO https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl
RUN chmod +x ./kubectl
RUN mv ./kubectl /usr/local/bin/kubectl
# Install helm
ENV HELM_DOWNLOAD="/tmp/helm.tar.gz"
ENV HELM_TMP="/tmp/helm"
RUN curl -SsL https://get.helm.sh/helm-$(curl -Ls https://github.com/helm/helm/releases | grep 'href="/helm/helm/releases/tag/v3.[0-9]*.[0-9]*\"' | sed -E 's/.*\/helm\/helm\/releases\/tag\/(v[0-9\.]+)".*/\1/g' | head -1)-linux-amd64.tar.gz -o ${HELM_DOWNLOAD}
RUN mkdir -p ${HELM_TMP}
RUN tar -xf ${HELM_DOWNLOAD} -C ${HELM_TMP}
RUN mv ${HELM_TMP}/linux-amd64/helm /usr/bin/helm
RUN rm -fr ${HELM_DOWNLOAD}
RUN rm -fr ${HELM_TMP}
# Enable go mod.
ENV GO111MODULE=on
# Install delve for debuging go files.
RUN go install github.com/go-delve/delve/cmd/[email protected]
# Set GOPROXY to ensure download modules
ENV GOPROXY=https://proxy.golang.org
# Set NODE_OPTIONS to increase NodeJS heap size
ENV NODE_OPTIONS=--max-old-space-size=8192
# To install go modules by user, add write access to $GOPATH (default: 755)
# `chmod +w` does not work, so set 777.
RUN chmod 777 -R /go
# Volume for source code
VOLUME ["/go/src/github.com/kubernetes/dashboard"]
# Mount point for kubeconfig
RUN mkdir -p /home/user/.kube
# Current directory is always dashboard source directory.
WORKDIR /go/src/github.com/kubernetes/dashboard
# Run gosu command in container.
CMD ./hack/develop/gosu-command.sh