forked from operator-framework/community-operators
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openshift-ms.Dockerfile
57 lines (42 loc) · 1.58 KB
/
openshift-ms.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
46
47
48
49
50
51
52
53
54
55
56
57
FROM golang:1.13.12-alpine3.12 as registry_builder
RUN apk --no-cache add \
git \
make \
sqlite \
gcc \
libc-dev
ENV REGISTRY_TAG v1.14.3
WORKDIR /src
RUN git clone https://github.com/operator-framework/operator-registry.git /tmp/registry \
&& cd /tmp/registry \
&& git reset --hard ${REGISTRY_TAG} \
&& mv vendor cmd pkg Makefile go.mod go.sum /src \
&& cd /src \
&& make build
# copy and build vendored grpc_health_probe
RUN mkdir -p /go/src/github.com/grpc-ecosystem && \
cp -R vendor/github.com/grpc-ecosystem/grpc-health-probe /go/src/github.com/grpc-ecosystem/grpc_health_probe && \
cp -R vendor/ /go/src/github.com/grpc-ecosystem/grpc_health_probe && \
cd /go/src/github.com/grpc-ecosystem/grpc_health_probe && \
CGO_ENABLED=0 go install -a -tags netgo -ldflags "-w"
FROM alpine:3.12 as bundles_builder
WORKDIR /registry
COPY --from=registry_builder /src/bin/ /usr/local/bin
COPY upstream-community-operators manifests
RUN initializer --permissive -o ./bundles.db
# Final runtime image
FROM alpine:3.12
WORKDIR /registry
COPY --from=registry_builder /src/bin/registry-server /usr/local/bin
COPY --from=registry_builder /go/bin/grpc-health-probe /usr/local/bin/
COPY --from=bundles_builder /registry/bundles.db /registry/bundles.db
RUN chgrp -R 0 /registry && \
chgrp -R 0 /dev && \
chmod -R g+rwx /registry && \
chmod -R g+rwx /dev && \
touch /etc/nsswitch.conf
# This image doesn't need to run as root user
USER 1001
EXPOSE 50051
ENTRYPOINT ["/usr/local/bin/registry-server"]
CMD ["--database", "/registry/bundles.db"]