forked from kubesphere/ks-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.complete
57 lines (39 loc) · 1.99 KB
/
Dockerfile.complete
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
FROM golang:1.16-alpine3.15
ARG appVersion=latest
RUN apk --no-cache add git ca-certificates && \
git clone --branch v1.0.0-beta.5 https://github.com/flant/shell-operator.git /go/src/github.com/flant/shell-operator
RUN go get -d github.com/flant/shell-operator/...
WORKDIR /go/src/github.com/flant/shell-operator
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X 'github.com/flant/shell-operator/pkg/app.Version=$appVersion'" -o shell-operator ./cmd/shell-operator
FROM python:3.10-alpine3.15
RUN apk --no-cache add jq yq bash curl unzip openssl && \
apk --no-cache add gcc libffi-dev openssl-dev musl-dev && \
export CRYPTOGRAPHY_DONT_BUILD_RUST=1 && \
pip install --no-cache-dir ansible_runner==2.0.1 ansible==2.9.23 kubernetes && \
apk del gcc libffi-dev openssl-dev musl-dev && \
wget https://get.helm.sh/helm-v3.6.3-linux-amd64.tar.gz && \
tar -zxf helm-v3.6.3-linux-amd64.tar.gz && \
mv linux-amd64/helm /bin/helm && \
rm -rf *linux-amd64* && \
chmod +x /bin/helm && \
wget https://storage.googleapis.com/kubernetes-release/release/v1.18.18/bin/linux/amd64/kubectl -O /bin/kubectl && \
chmod +x /bin/kubectl && \
ln -s /bin/kubectl /usr/local/bin/kubectl && \
ln -s /bin/helm /usr/local/bin/helm && \
mkdir -p /hooks/kubesphere /kubesphere/installer/roles /kubesphere/results/env /kubesphere/playbooks /kubesphere/config &&\
adduser -D -g kubesphere -u 1002 kubesphere
COPY --from=0 /go/src/github.com/flant/shell-operator/shell-operator /
ADD controller/* /hooks/kubesphere/
RUN chown -R kubesphere:kubesphere /shell-operator && \
chown -R kubesphere:kubesphere /hooks && \
chown -R kubesphere:kubesphere /kubesphere && \
chmod +x -R /hooks/kubesphere
USER kubesphere
ENV SHELL_OPERATOR_WORKING_DIR /hooks
ENV ANSIBLE_ROLES_PATH /kubesphere/installer/roles
WORKDIR /kubesphere
ADD roles /kubesphere/installer/roles
ADD env /kubesphere/results/env
ADD playbooks /kubesphere/playbooks
ENTRYPOINT ["/shell-operator"]
CMD ["start"]