forked from openstack-k8s-operators/keystone-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
75 lines (54 loc) · 2.28 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
ARG GOLANG_BUILDER=golang:1.17
ARG OPERATOR_BASE_IMAGE=gcr.io/distroless/static:nonroot
# Build the manager binary
FROM $GOLANG_BUILDER AS builder
#Arguments required by OSBS build system
ARG CACHITO_ENV_FILE=/remote-source/cachito.env
ARG REMOTE_SOURCE=.
ARG REMOTE_SOURCE_DIR=/remote-source
ARG REMOTE_SOURCE_SUBDIR=
ARG DEST_ROOT=/dest-root
ARG GO_BUILD_EXTRA_ARGS=
COPY $REMOTE_SOURCE $REMOTE_SOURCE_DIR
WORKDIR $REMOTE_SOURCE_DIR/$REMOTE_SOURCE_SUBDIR
RUN mkdir -p ${DEST_ROOT}/usr/local/bin/
# 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 if [ ! -f $CACHITO_ENV_FILE ]; then go mod download ; fi
# Build manager
RUN if [ -f $CACHITO_ENV_FILE ] ; then source $CACHITO_ENV_FILE ; fi ; CGO_ENABLED=0 GO111MODULE=on go build ${GO_BUILD_EXTRA_ARGS} -a -o ${DEST_ROOT}/manager main.go
RUN cp -r templates ${DEST_ROOT}/templates
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM $OPERATOR_BASE_IMAGE
ARG DEST_ROOT=/dest-root
ARG USER_ID=nonroot:nonroot
ARG IMAGE_COMPONENT="keystone-operator-container"
ARG IMAGE_NAME="keystone-operator"
ARG IMAGE_VERSION="1.0.0"
ARG IMAGE_SUMMARY="Keystone Operator"
ARG IMAGE_DESC="This image includes the keystone-operator"
ARG IMAGE_TAGS="cn-openstack openstack"
### DO NOT EDIT LINES BELOW
# Auto generated using CI tools from
# https://github.com/openstack-k8s-operators/openstack-k8s-operators-ci
# Labels required by upstream and osbs build system
LABEL com.redhat.component="${IMAGE_COMPONENT}" \
name="${IMAGE_NAME}" \
version="${IMAGE_VERSION}" \
summary="${IMAGE_SUMMARY}" \
io.k8s.name="${IMAGE_NAME}" \
io.k8s.description="${IMAGE_DESC}" \
io.openshift.tags="${IMAGE_TAGS}"
### DO NOT EDIT LINES ABOVE
ENV USER_UID=1001 \
OPERATOR_TEMPLATES=/usr/share/keystone-operator/templates/ \
WATCH_NAMESPACE=openstack,openshift-machine-api,openshift-sriov-network-operator
WORKDIR /
# Install operator binary to WORKDIR
COPY --from=builder ${DEST_ROOT}/manager .
# Install templates
COPY --from=builder ${DEST_ROOT}/templates ${OPERATOR_TEMPLATES}
USER $USER_ID
ENV PATH="/:${PATH}"
ENTRYPOINT ["/manager"]