-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
32 lines (23 loc) · 930 Bytes
/
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
FROM hadolint/hadolint:v1.23.0 AS hadolint
FROM koalaman/shellcheck:v0.9.0 AS shellcheck
FROM alpine:3.16 as build
WORKDIR /tmp/build
ENV KUBE_VERSION="1.11.10"
ENV kubectlURL https://storage.googleapis.com/kubernetes-release/release/v${KUBE_VERSION}/bin/linux/amd64/kubectl
# hadolint ignore=DL3018
RUN apk --no-cache --quiet add jq curl upx; \
curl -L -s -o /usr/local/bin/kubectl \
${kubectlURL} && \
chmod +x /usr/local/bin/kubectl && \
upx --brute /usr/local/bin/kubectl
# Lint, test
COPY . .
COPY --from=hadolint /bin/hadolint /usr/local/bin/hadolint
COPY --from=shellcheck /bin/shellcheck /usr/local/bin/shellcheck
RUN /usr/local/bin/hadolint ./Dockerfile
RUN /usr/local/bin/shellcheck --format=gcc ./bin/*
FROM alpine:3.16
RUN apk --no-cache --quiet add jq~=1.6 bash~=4.4
COPY --from=build /usr/local/bin/kubectl /usr/local/bin/kubectl
COPY bin/* /opt/resource/
CMD ["/usr/local/bin/kubectl"]