Skip to content

Commit f544e22

Browse files
committedMar 15, 2019
feat(builder): add builder dockerfile (contains tools for building a
registry image) intended to be used as a parent image for upstream catalogs
1 parent bf04182 commit f544e22

7 files changed

+27
-29
lines changed
 

‎Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ COPY vendor vendor
1313
COPY cmd cmd
1414
COPY pkg pkg
1515
COPY Makefile Makefile
16-
RUN make static
16+
RUN make static-rh
1717

1818
# copy and build vendored grpc_health_probe
1919
RUN mkdir -p /go/src/github.com/grpc-ecosystem && \

‎Makefile

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
CMDS := $(addprefix bin/, $(shell go list ./cmd/... | xargs -I{} basename {}))
2-
MOD_FLAGS := $(shell (go version | grep -q 1.11) && echo -mod=vendor)
1+
MOD_FLAGS := $(shell (go version | grep -q -E "1\.(11|12)") && echo -mod=vendor)
2+
CMDS := $(addprefix bin/, $(shell go list $(MOD_FLAGS) ./cmd/... | xargs -I{} basename {}))
33

44
.PHONY: build test vendor clean
55

@@ -10,9 +10,12 @@ $(CMDS):
1010

1111
build: clean $(CMDS)
1212

13-
static: extra_flags=-ldflags '-w -extldflags "-Wl,-Bstatic -ldl -lc -lpthread -lcrypto -lz -static"'
13+
static: extra_flags=-ldflags '-w -extldflags "-static"'
1414
static: build
1515

16+
static-rh: extra_flags=-ldflags '-w -extldflags "-Wl,-Bstatic -ldl -lc -lpthread -lcrypto -lz -static"'
17+
static-rh: build
18+
1619
unit:
1720
go test $(MOD_FLAGS) -count=1 --tags json1 -v -race ./pkg/...
1821

‎go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ require (
2929
github.com/operator-framework/go-appr v0.0.0-20180917210448-f2aef88446f2
3030
github.com/operator-framework/operator-lifecycle-manager v0.0.0-20190125151539-1e295784b30a
3131
github.com/operator-framework/operator-marketplace v0.0.0-20190216021216-57300a3ef3ba
32-
github.com/prometheus/common v0.0.0-20190104105734-b1c43a6df3ae
3332
github.com/sirupsen/logrus v1.2.0
3433
github.com/soheilhy/cmux v0.1.4 // indirect
3534
github.com/spf13/cobra v0.0.3
@@ -38,6 +37,7 @@ require (
3837
github.com/ugorji/go v1.1.1 // indirect
3938
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a
4039
golang.org/x/oauth2 v0.0.0-20181105165119-ca4130e427c7 // indirect
40+
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
4141
golang.org/x/tools v0.0.0-20181207222222-4c874b978acb // indirect
4242
google.golang.org/grpc v1.17.0
4343
k8s.io/api v0.0.0-20190118113203-912cbe2bfef3

‎go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
207207
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
208208
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c h1:fqgJT0MGcGpPgpWU7VRdRjuArfcOvC4AoJmILihzhDg=
209209
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
210+
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ=
211+
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
210212
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
211213
golang.org/x/tools v0.0.0-20181011152555-a398e557df60/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
212214
golang.org/x/tools v0.0.0-20181207222222-4c874b978acb/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

‎upstream-builder.Dockerfile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM golang:1.12-alpine
2+
3+
RUN apk update && apk add sqlite build-base git mercurial
4+
WORKDIR /build
5+
6+
COPY vendor vendor
7+
COPY cmd cmd
8+
COPY pkg pkg
9+
COPY Makefile Makefile
10+
COPY go.mod go.mod
11+
RUN make static
12+
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.1 && \
13+
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
14+
chmod +x /bin/grpc_health_probe

‎upstream-example.Dockerfile

+2-23
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,12 @@
1-
FROM golang:1.11-alpine as builder
2-
3-
RUN apk update && apk add sqlite build-base git mercurial
4-
WORKDIR /build
5-
6-
COPY vendor vendor
7-
COPY cmd cmd
8-
COPY pkg pkg
9-
COPY Makefile Makefile
10-
COPY go.mod go.mod
11-
RUN make static
1+
FROM quay.io/operator-framework/upstream-registry-builder as builder
122

133
COPY manifests manifests
144
RUN ./bin/initializer -o ./bundles.db
155

16-
FROM golang:1.10-alpine as probe-builder
17-
18-
RUN apk update && apk add build-base git
19-
ENV ORG github.com/grpc-ecosystem
20-
ENV PROJECT $ORG/grpc_health_probe
21-
WORKDIR /go/src/$PROJECT
22-
23-
COPY --from=builder /build/vendor/$ORG/grpc-health-probe .
24-
COPY --from=builder /build/vendor .
25-
RUN CGO_ENABLED=0 go install -a -tags netgo -ldflags "-w"
26-
276
FROM scratch
287
COPY --from=builder /build/bundles.db /bundles.db
298
COPY --from=builder /build/bin/registry-server /registry-server
30-
COPY --from=probe-builder /go/bin/grpc_health_probe /bin/grpc_health_probe
9+
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
3110
EXPOSE 50051
3211
ENTRYPOINT ["/registry-server"]
3312
CMD ["--database", "bundles.db"]

‎vendor/modules.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ golang.org/x/text/unicode/bidi
145145
golang.org/x/text/unicode/norm
146146
golang.org/x/text/transform
147147
golang.org/x/text/width
148-
# golang.org/x/time v0.0.0-20181108054448-85acf8d2951c
148+
# golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
149149
golang.org/x/time/rate
150150
# google.golang.org/genproto v0.0.0-20181016170114-94acd270e44e
151151
google.golang.org/genproto/googleapis/rpc/status

0 commit comments

Comments
 (0)
Please sign in to comment.