forked from zoosky/helmi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.selfcontained
55 lines (41 loc) · 1.55 KB
/
Dockerfile.selfcontained
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
FROM golang:1.9-alpine as builder
# Chart repository url
ARG CHART_REPO=https://github.com/monostream/helm-charts.git
ENV CHART_REPO ${CHART_REPO}
# Install dependencies
RUN apk add --update --no-cache tar wget git ca-certificates
# Build helmi
WORKDIR /go/src/github.com/monostream/helmi/
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o helmi .
# Copy helm artefacts
WORKDIR /app/
RUN cp /go/src/github.com/monostream/helmi/helmi .
RUN cp -r /go/src/github.com/monostream/helmi/catalog .
RUN rm -r /go/src/
# Add local charts
RUN git clone --no-checkout --depth 1 ${CHART_REPO} monostream
RUN cd monostream && \
git config core.sparseCheckout true && \
printf "muescheli\ncassandra\nelk\nloggli\nrsyslog-as"> .git/info/sparse-checkout && \
git checkout
# Download helm 2.8.2
RUN wget -nv -O- https://storage.googleapis.com/kubernetes-helm/helm-v2.8.2-linux-amd64.tar.gz | tar --strip-components=1 -zxf -
# Download dumb-init 1.2.1
RUN wget -nv -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 && chmod 755 /usr/local/bin/dumb-init
FROM alpine:3.7
RUN apk --no-cache add ca-certificates
WORKDIR /app/
COPY --from=builder /app/ .
COPY --from=builder /usr/local/bin/dumb-init /usr/local/bin/dumb-init
# Setup environment
ENV PATH "/app:${PATH}"
RUN addgroup -S helmi && \
adduser -S -G helmi helmi && \
chown -R helmi:helmi /app
USER helmi
# Initialize helm
RUN helm init --client-only
RUN helm repo update
ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]
CMD ["helmi"]