-
Notifications
You must be signed in to change notification settings - Fork 157
/
Dockerfile
33 lines (23 loc) · 1.06 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
FROM golang:alpine3.17
# install tools (bash, git, protobuf, protoc-gen-go, protoc-grn-go-grpc, pkger)
RUN apk -U --no-cache add bash git protobuf &&\
go install -v github.com/golang/protobuf/protoc-gen-go@latest &&\
go install -v google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest &&\
go install github.com/markbates/pkger/cmd/pkger@latest
# cloning well-known-types
# only use needed files
RUN git clone --depth=1 https://github.com/google/protobuf.git /protobuf-repo &&\
mv /protobuf-repo/src/ /protobuf/ &&\
rm -rf /protobuf-repo
COPY . /go/src/github.com/tokopedia/gripmock
# create necessary dirs and export fix_gopackage.sh
RUN mkdir /proto /stubs &&\
ln -s /go/src/github.com/tokopedia/gripmock/fix_gopackage.sh /bin/
WORKDIR /go/src/github.com/tokopedia/gripmock/protoc-gen-gripmock
# install generator plugin
RUN pkger && go install -v
WORKDIR /go/src/github.com/tokopedia/gripmock
# install gripmock & build example to cache necessary imports
RUN go install -v && go build ./example/simple/client
EXPOSE 4770 4771
ENTRYPOINT ["gripmock"]