-
Notifications
You must be signed in to change notification settings - Fork 26
/
Dockerfile
76 lines (52 loc) · 1.97 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
76
# Build the manager binary
ARG GOLANG_BUILDER=registry.access.redhat.com/ubi9/go-toolset:1.21
ARG OPERATOR_BASE_IMAGE=registry.access.redhat.com/ubi9/ubi-minimal:latest
FROM $GOLANG_BUILDER as builder
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="-tags strictfipsruntime"
ARG GO_BUILD_EXTRA_ENV_ARGS="CGO_ENABLED=1 GO111MODULE=on"
COPY $REMOTE_SOURCE $REMOTE_SOURCE_DIR
WORKDIR $REMOTE_SOURCE_DIR/$REMOTE_SOURCE_SUBDIR
USER root
RUN mkdir -p ${DEST_ROOT}/usr/local/bin/
ARG TARGETOS
ARG TARGETARCH
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 ; env ${GO_BUILD_EXTRA_ENV_ARGS} go build ${GO_BUILD_EXTRA_ARGS} -a -o ${DEST_ROOT}/manager main.go
RUN cp -r templates ${DEST_ROOT}/templates
FROM $OPERATOR_BASE_IMAGE
ARG DEST_ROOT=/dest-root
ARG USER_ID=65532
ARG IMAGE_COMPONENT="heat-operator-container"
ARG IMAGE_NAME="heat-operator"
ARG IMAGE_VERSION="1.0.0"
ARG IMAGE_SUMMARY="Heat Operator"
ARG IMAGE_DESC="This image includes the heat-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=$USER_ID \
OPERATOR_TEMPLATES=/usr/share/heat-operator/templates/
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"]