forked from openshift/assisted-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.assisted-service.ocp
39 lines (29 loc) · 1.6 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
# Build binaries
FROM registry.ci.openshift.org/openshift/release:golang-1.17 as builder
WORKDIR /src
COPY . .
RUN CGO_ENABLED=1 GOFLAGS="" GO111MODULE=on go build -o /build/assisted-service cmd/main.go
RUN CGO_ENABLED=0 GOFLAGS="" GO111MODULE=on go build -o /build/assisted-service-operator cmd/operator/main.go
RUN CGO_ENABLED=0 GOFLAGS="" GO111MODULE=on go build -o /build/assisted-service-admission cmd/webadmission/main.go
RUN CGO_ENABLED=0 GOFLAGS="" GO111MODULE=on go build -o /build/agent-installer-client cmd/agentbasedinstaller/client/main.go
FROM registry.ci.openshift.org/ocp/4.11:cli AS oc-image
# Create final image
FROM registry.ci.openshift.org/ocp/4.11: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 && 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"]