-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.server
63 lines (46 loc) · 1.83 KB
/
Dockerfile.server
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
58
59
60
61
62
63
FROM golang:1.22.0 AS builder
ARG CHECK_CHART_VERSION=0.0.5
RUN apt-get update && apt-get install -y gcc git musl-dev musl-tools wget
WORKDIR /workspace
COPY . .
RUN case `uname -m` in \
x86_64) ARCH=amd64; ;; \
armv7l) ARCH=arm; ;; \
aarch64) ARCH=arm64; ;; \
ppc64le) ARCH=ppc64le; ;; \
s390x) ARCH=s390x; ;; \
*) echo "un-supported arch, exit ..."; exit 1; ;; \
esac && \
wget https://github.com/beclab/check-chart/releases/download/v${CHECK_CHART_VERSION}/check-chart_${CHECK_CHART_VERSION}_linux_${ARCH}.tar.gz -O - | tar -xz
RUN go mod download
RUN CGO_ENABLED=1 CC=musl-gcc CGO_LDFLAGS="-static" go build -ldflags="-s -w" -a -o devbox cmd/devbox/main.go
FROM alpine:latest as builder2
WORKDIR /
ARG VERSION=2.12.0
ENV BASE_URL="https://get.helm.sh"
RUN sed -i 's/https/http/' /etc/apk/repositories
RUN case `uname -m` in \
x86_64) ARCH=amd64; ;; \
armv7l) ARCH=arm; ;; \
aarch64) ARCH=arm64; ;; \
ppc64le) ARCH=ppc64le; ;; \
s390x) ARCH=s390x; ;; \
*) echo "un-supported arch, exit ..."; exit 1; ;; \
esac && \
apk add --update --no-cache wget git curl bash yq && \
wget ${BASE_URL}/helm-v${VERSION}-linux-${ARCH}.tar.gz -O - | tar -xz && \
mv linux-${ARCH}/helm /usr/bin/helm && \
chmod +x /usr/bin/helm && \
rm -rf linux-${ARCH}
RUN helm init --stable-repo-url=https://charts.helm.sh/stable --client-only
RUN helm plugin install https://github.com/chartmuseum/helm-push
FROM alpine:latest
WORKDIR /
VOLUME [ "/charts" ]
VOLUME [ "/data" ]
COPY --from=builder /workspace/devbox /devbox
COPY --from=builder /workspace/check-chart /usr/local/bin/check-chart
COPY --from=builder2 /usr/bin/helm /usr/bin/helm
COPY --from=builder2 /root/.helm /root/.helm
RUN chmod +x /usr/bin/helm && chmod +x /usr/local/bin/check-chart
ENTRYPOINT ["/devbox"]