forked from flant/addon-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-alpine3.10
43 lines (36 loc) · 1.54 KB
/
Dockerfile-alpine3.10
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
# build libjq
FROM alpine:3.10 AS libjq
RUN apk --no-cache add git ca-certificates && \
git clone https://github.com/flant/libjq-go /libjq-go && \
cd /libjq-go && \
git submodule update --init --recursive && \
/libjq-go/scripts/install-libjq-dependencies-alpine.sh && \
/libjq-go/scripts/build-libjq-static.sh /libjq-go /libjq
# build addon-operator binary linked with libjq
FROM golang:1.13-alpine3.10 AS addon-operator
ARG appVersion=latest
RUN apk --no-cache add git ca-certificates gcc libc-dev
# Cache-friendly download of go dependencies.
ADD go.mod go.sum /addon-operator/
WORKDIR /addon-operator
RUN go mod download
COPY --from=libjq /libjq /libjq
ADD . /addon-operator
WORKDIR /addon-operator
RUN git submodule update --init --recursive && ./go-build.sh $appVersion
# build final image
FROM alpine:3.10
RUN apk --no-cache add ca-certificates jq bash tini && \
wget https://storage.googleapis.com/kubernetes-release/release/v1.13.5/bin/linux/amd64/kubectl -O /bin/kubectl && \
chmod +x /bin/kubectl && \
wget https://storage.googleapis.com/kubernetes-helm/helm-v2.14.3-linux-amd64.tar.gz -O /helm.tgz && \
tar -z -x -C /bin -f /helm.tgz --strip-components=1 linux-amd64/helm linux-amd64/tiller && \
rm -f /helm.tgz && \
helm init --client-only && \
mkdir /hooks
COPY --from=addon-operator /addon-operator/addon-operator /
COPY --from=addon-operator /addon-operator/shell-operator/frameworks /
WORKDIR /
ENV MODULES_DIR /modules
ENV GLOBAL_HOOKS_DIR /global-hooks
ENTRYPOINT ["/sbin/tini", "--", "/addon-operator"]