forked from jibudata/amberapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.hook
45 lines (37 loc) · 1.63 KB
/
Dockerfile.hook
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
# Build the manager binary
FROM golang:1.15 as builder
ENV GOPROXY=https://goproxy.cn,direct
#ARG GOPROXY
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the go source
COPY cmd/apphook/main.go cmd/apphook/main.go
COPY cmd/mysql_demo/main.go cmd/mysql_demo/main.go
COPY api/ api/
#COPY controllers/ controllers/
COPY pkg/ pkg/
COPY hack/ hack/
# COPY vendor/ vendor/
# Build
ENV BUILDTAGS containers_image_ostree_stub exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp exclude_graphdriver_overlay
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -tags "$BUILDTAGS" -a -o apphook cmd/apphook/main.go
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -tags "$BUILDTAGS" -a -o mysqlops cmd/mysql_demo/main.go
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
# Download gcr.io/xxx images with following commands
# curl -s https://zhangguanzhang.github.io/bash/pull.sh | bash -s -- gcr.io/distroless/static:nonroot
# FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
#FROM jibutech/ubi8-minimal:latest
FROM centos:7
WORKDIR /
COPY --from=builder /workspace/apphook .
COPY --from=builder /workspace/mysqlops .
COPY --from=builder /workspace/hack/create.sh .
COPY --from=builder /workspace/hack/quiesce.sh .
COPY --from=builder /workspace/hack/unquiesce.sh .
ENTRYPOINT ["/bin/sleep", "infinity"]