forked from openshift/assisted-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.assisted-service.ocp
44 lines (33 loc) · 1.89 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
42
43
44
# URGENT! ART metadata configuration has a different number of FROMs
# than this Dockerfile. ART will be unable to build your component or
# reconcile this Dockerfile until that disparity is addressed.
# Build binaries
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.19-openshift-4.12 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
FROM registry.ci.openshift.org/ocp/4.12:cli AS oc-image
# Create final image
FROM registry.ci.openshift.org/ocp/4.12:base
LABEL io.openshift.release.operator=true
# ToDo: Replace postgres with SQLite DB
# https://issues.redhat.com/browse/AGENT-223
RUN dnf install -y postgresql-server libvirt-libs nmstate nmstate-libs && 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=oc-image /usr/bin/oc /usr/local/bin/
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"]