forked from hyperledger-labs/fabric-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
42 lines (34 loc) · 1.24 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
ARG GO_VER
########## Build operator binary ##########
FROM registry.access.redhat.com/ubi8/go-toolset:$GO_VER as builder
COPY . /go/src/github.com/hyperledger-labs/fabric-operator
WORKDIR /go/src/github.com/hyperledger-labs/fabric-operator
# RUN GOOS=linux GOARCH=$(go env GOARCH) CGO_ENABLED=1 go build
RUN go build \
-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"]