forked from openshift/assisted-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.assisted-service.ocp
41 lines (30 loc) · 1.78 KB
/
Dockerfile.assisted-service.ocp
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
# Build binaries
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.21-openshift-4.16 AS builder
WORKDIR /src
COPY . .
RUN dnf install -y gcc nmstate-devel nmstate-libs git && dnf clean all
RUN cd cmd && CGO_ENABLED=1 GOFLAGS="" GO111MODULE=on go build -o /build/assisted-service
RUN cd ./cmd/operator && CGO_ENABLED=1 GOFLAGS="" GO111MODULE=on go build -o /build/assisted-service-operator
RUN cd ./cmd/webadmission && CGO_ENABLED=1 GOFLAGS="" GO111MODULE=on go build -o /build/assisted-service-admission
RUN cd ./cmd/agentbasedinstaller/client && CGO_ENABLED=1 GOFLAGS="" GO111MODULE=on go build -o /build/agent-installer-client
# Create final image
FROM registry.ci.openshift.org/ocp/4.16:base-rhel9
LABEL io.openshift.release.operator=true
# multiarch images need skopeo until WRKLDS-222 and https://bugzilla.redhat.com/show_bug.cgi?id=2111537 are fixed
# ToDo: Replace postgres with SQLite DB
# https://issues.redhat.com/browse/AGENT-223
RUN dnf install -y postgresql-server libvirt-libs nmstate nmstate-libs skopeo openshift-clients && dnf clean all
RUN dnf update libksba libxml2 -y && dnf clean all
COPY hack/agent_installer/start_db.sh start_db.sh
RUN su - postgres -c "mkdir -p /tmp/postgres/data"
RUN su - postgres -c "/usr/bin/initdb -D /tmp/postgres/data"
ARG WORK_DIR=/data
RUN mkdir $WORK_DIR && chmod 775 $WORK_DIR
COPY --from=builder /build/assisted-service /assisted-service
COPY --from=builder /build/assisted-service-operator /assisted-service-operator
COPY --from=builder /build/assisted-service-admission /assisted-service-admission
COPY --from=builder /build/agent-installer-client /usr/local/bin/agent-installer-client
RUN ln -s /usr/local/bin/agent-installer-client /agent-based-installer-register-cluster-and-infraenv
ENV GODEBUG=madvdontneed=1
ENV GOGC=50
CMD ["/assisted-service"]