forked from kubernetes-sigs/kubebuilder
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathDockerfile
56 lines (47 loc) · 1.49 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
FROM golang:1.14.6-buster as builder
LABEL maintainer="zhangguanzhang <[email protected]>"
ARG mdbookVersion=v0.3.1
ENV GOBIN=/go/bin/ \
CGO_ENABLED=0 \
GO111MODULE="on" \
GOPROXY="https://goproxy.cn,https://mirrors.aliyun.com/goproxy/,https://goproxy.io,direct"
COPY utils /go/src/utils
RUN os=$(go env GOOS) \
&& arch=$(go env GOARCH) \
&& echo $os $arch \
&& if [ "${arch}" = "amd64" ]; then \
arch="x86_64"; \
elif [ "${arch}" = "x86" ]; then \
arch="i686"; \
fi \
&& case ${os} in \
windows) \
target="pc-windows-msvc" \
ext="zip" \
cmd="unzip -d /tmp" \
;; \
darwin) \
target="apple-darwin" \
;; \
linux) \
# works for linux, too
target="unknown-${os}-gnu" \
;; \
*) \
target="unknown-${os}" \
;; \
esac \
&& curl -L https://github.com/rust-lang-nursery/mdBook/releases/download/${mdbookVersion}/mdBook-${mdbookVersion}-${arch}-${target}.tar.gz \
| tar -zxf - -C /go/bin/ \
&& go get sigs.k8s.io/controller-tools/cmd/[email protected] \
&& cd /go/src/utils/ \
&& go build -o /go/bin/literate-go ./litgo \
&& go build -o /go/bin/marker-docs ./markerdocs
FROM frolvlad/alpine-glibc
COPY --from=builder /go/bin/* /bin/
ENV IN_DOCKER=true
RUN apk add bash && \
rm -rf /var/cache/apk/*
WORKDIR /opt
ENTRYPOINT ["/bin/mdbook"]
CMD ["build"]