This repository has been archived by the owner on Jul 30, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added openshift Dockerfile with multi-stage support
Signed-off-by: Eduard Kracmar <eduard.kracmar@hotovo.org>
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
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.5.6 | ||
|
||
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 | ||
|
||
# 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"] |