forked from fluid-cloudnative/fluid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.csi
37 lines (29 loc) · 1.38 KB
/
Dockerfile.csi
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
# Build the csi binary
FROM golang:1.14.2 as builder
WORKDIR /go/src/github.com/fluid-cloudnative/fluid
COPY . .
# Build
# RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o csi main.go
#RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=off go build -a -o /go/bin/fluid-csi cmd/csi/*.go
RUN make csi-build && \
cp bin/fluid-csi /go/bin/fluid-csi
# RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=off go build -gcflags="-N -l" -a -o /go/bin/fluid-csi cmd/csi/*.go
# Debug
#RUN go get github.com/go-delve/delve/cmd/dlv
# Use distroless as minimal base image to package the csi binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM alpine:3.10
RUN apk add --update curl tzdata iproute2 bash libc6-compat vim && \
rm -rf /var/cache/apk/* && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
WORKDIR /
COPY --from=builder /go/bin/fluid-csi /usr/local/bin/fluid-csi
#COPY --from=builder /go/bin/dlv /usr/local/bin/dlv
ADD csi/shell/check_mount.sh /usr/local/bin/check_mount.sh
ADD csi/shell/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod u+x /usr/local/bin/fluid-csi && \
chmod u+x /usr/local/bin/check_mount.sh && \
chmod u+x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
# ENTRYPOINT ["dlv", "--listen=:12345", "exec", "/usr/local/bin/fluid-csi", "--"]