-
Notifications
You must be signed in to change notification settings - Fork 36
/
Dockerfile
45 lines (35 loc) · 1.41 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
ARG GO_VER
########## Build operator binary ##########
FROM registry.access.redhat.com/ubi8/ubi-minimal as builder
ARG GO_VER
ARG ARCH
# gcc required for cgo
RUN microdnf install -y tar gzip gcc
RUN curl -sL https://go.dev/dl/go${GO_VER}.linux-${ARCH}.tar.gz | tar zxf - -C /usr/local
ENV PATH="/usr/local/go/bin:$PATH"
COPY . /go/src/github.com/IBM-Blockchain/fabric-operator
WORKDIR /go/src/github.com/IBM-Blockchain/fabric-operator
RUN GOOS=linux GOARCH=${ARCH} CGO_ENABLED=1 go build -mod=vendor -buildvcs=false -tags "pkcs11" -gcflags all=-trimpath=${GOPATH} -asmflags all=-trimpath=${GOPATH} -o /tmp/build/_output/bin/ibp-operator
########## Final Image ##########
FROM registry.access.redhat.com/ubi8/ubi-minimal
ENV OPERATOR=/usr/local/bin/ibp-operator
COPY --from=builder /tmp/build/_output/bin/ibp-operator ${OPERATOR}
COPY build/ /usr/local/bin
COPY definitions /definitions
COPY config/crd/bases /deploy/crds
COPY defaultconfig /defaultconfig
COPY docker-entrypoint.sh .
RUN microdnf update \
&& microdnf install -y \
shadow-utils \
iputils \
&& groupadd -g 7051 fabric-user \
&& useradd -u 7051 -g fabric-user -s /bin/bash fabric-user \
&& mkdir /licenses \
&& microdnf remove shadow-utils \
&& microdnf clean all \
&& chown -R fabric-user:fabric-user licenses \
&& /usr/local/bin/user_setup
USER fabric-user
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/local/bin/entrypoint"]