Skip to content

Commit 58500b9

Browse files
committedDec 19, 2018
feat(codegen): add container-codegen make rule
1 parent b16cf54 commit 58500b9

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed
 

‎Makefile

+8-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ vendor:
2626
go mod vendor
2727

2828
codegen:
29-
protoc -I pkg/api/ -I${GOPATH}/src --go_out=plugins=grpc:pkg/api pkg/api/*.proto
30-
protoc -I pkg/api/grpc_health_v1 -I${GOPATH}/src --go_out=plugins=grpc:pkg/api/grpc_health_v1 pkg/api/grpc_health_v1/*.proto
29+
protoc -I pkg/api/ --go_out=plugins=grpc:pkg/api pkg/api/*.proto
30+
protoc -I pkg/api/grpc_health_v1 --go_out=plugins=grpc:pkg/api/grpc_health_v1 pkg/api/grpc_health_v1/*.proto
31+
32+
container-codegen:
33+
docker build -t operator-registry:codegen -f codegen.Dockerfile .
34+
docker run --name temp-codegen operator-registry:codegen /bin/true
35+
docker cp temp-codegen:/codegen/pkg/api/. ./pkg/api
36+
docker rm temp-codegen
3137

3238
clean:
3339
@rm -rf ./bin

‎codegen.Dockerfile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM golang:1.11-alpine
2+
3+
RUN apk update && \
4+
apk add make git protobuf
5+
6+
ENV MODULE github.com/golang/protobuf
7+
ENV SRC ${GOPATH}/src/${MODULE}
8+
COPY vendor/${MODULE} ${SRC}
9+
RUN echo $(ls ${SRC})
10+
RUN go install ${SRC}/proto ${SRC}/ptypes ${SRC}/protoc-gen-go
11+
12+
13+
WORKDIR /codegen
14+
15+
COPY pkg pkg
16+
COPY Makefile Makefile
17+
RUN make codegen
18+
19+
LABEL maintainer="Odin Team <aos-odin@redhat.com>"

0 commit comments

Comments
 (0)
Please sign in to comment.