-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
57 lines (53 loc) · 2.24 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
FROM golang:1.17.1-alpine3.14
RUN mkdir -p /go/src/github.com/hightoxicity/k8s-nodepool-cordon
WORKDIR /go/src/github.com/hightoxicity/k8s-nodepool-cordon
COPY . ./
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-w -s -v -extldflags -static" -a main.go
FROM docker:19.03.11 as static-docker-source
FROM alpine:3.14
COPY --from=0 /go/src/github.com/hightoxicity/k8s-nodepool-cordon/main /k8s-nodepool-cordon
ARG CLOUD_SDK_VERSION=358.0.0
ENV CLOUD_SDK_VERSION=$CLOUD_SDK_VERSION
ENV PATH /google-cloud-sdk/bin:$PATH
COPY --from=static-docker-source /usr/local/bin/docker /usr/local/bin/docker
RUN addgroup -g 1000 -S cloudsdk && \
adduser -u 1000 -S cloudsdk -G cloudsdk
RUN apk --no-cache add \
curl \
python3 \
py3-crcmod \
py3-openssl \
bash \
libc6-compat \
openssh-client \
git \
gnupg \
&& curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \
tar xzf google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \
rm google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \
gcloud config set core/disable_usage_reporting true && \
gcloud config set component_manager/disable_update_check true && \
gcloud config set metrics/environment github_docker_image && \
gcloud --version
#WORKDIR /
#RUN apk --no-cache add \
# curl \
# python3 \
# py3-pip \
# bash \
# libc6-compat \
# openssh-client \
# git && \
# pip3 install --upgrade pip && \
# pip install wheel && \
# pip install crcmod && \
# curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \
# tar xzf google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-x86_64.tar.gz -C / && \
# rm google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \
# ln -s /lib /lib64 && \
# gcloud config set core/disable_usage_reporting true && \
# gcloud config set component_manager/disable_update_check true && \
# gcloud config set metrics/environment github_docker_image && \
# gcloud --version
ENTRYPOINT ["/k8s-nodepool-cordon"]
CMD ["-help"]