-
Notifications
You must be signed in to change notification settings - Fork 27
/
Dockerfile.agent
61 lines (46 loc) · 1.97 KB
/
Dockerfile.agent
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
ARG GOLANG_BUILDER=registry.access.redhat.com/ubi9/go-toolset:1.21
ARG OPERATOR_BASE_IMAGE=registry.access.redhat.com/ubi9/ubi-minimal:latest
# 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 WHAT=openstack-baremetal-agent
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 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}/${WHAT} ./containers/agent
# 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
# Those arguments must match ones from builder
ARG DEST_ROOT=/dest-root
ARG WHAT=openstack-baremetal-agent
ARG IMAGE_COMPONENT="openstack-baremetal-agent-container"
ARG IMAGE_NAME="openstack-baremetal-agent"
ARG IMAGE_VERSION="1.0.0"
ARG IMAGE_SUMMARY="OpenStack-Baremetal-Operator-Agent"
ARG IMAGE_DESC="This is agent that works with the OpenStack Baremetal Operator"
ARG IMAGE_TAGS="openstack baremetal"
### 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
WORKDIR /
# Install binary to WORKDIR
COPY --from=builder ${DEST_ROOT}/${WHAT} .
ENV PATH="/:${PATH}"
ENTRYPOINT ["/openstack-baremetal-agent"]