File tree 1 file changed +25
-3
lines changed
1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,30 @@ WORKDIR /usr/src/app/
8
8
RUN apk update \
9
9
&& apk add --no-cache make protobuf-dev
10
10
11
- COPY ./src/accountingservice/ ./
12
- RUN go build -o /go/bin/accountingservice/
11
+ WORKDIR /usr/src/app
12
+
13
+ RUN apk update \
14
+ && apk add --no-cache make protobuf-dev
15
+
16
+ COPY ./src/accountingservice/go.sum tools/go.sum
17
+ COPY ./src/accountingservice/go.mod tools/go.mod
18
+ COPY ./src/accountingservice/tools.go tools/tools.go
19
+
20
+ WORKDIR /usr/src/app/tools
21
+
22
+ RUN go mod download \
23
+ && go list -e -f '{{range .Imports}}{{.}} {{end}}' tools.go | CGO_ENABLED=0 xargs go install -mod=readonly
24
+
25
+ WORKDIR /usr/src/app/
26
+
27
+ COPY ./src/accountingservice ./src/accountingservice
28
+ COPY ./pb ./pb
29
+
30
+ RUN protoc -I ./pb ./pb/demo.proto --go_out=./src/accountingservice --go-grpc_out=./src/accountingservice
31
+ WORKDIR /usr/src/app/src/accountingservice
32
+ RUN go build -ldflags "-s -w" -o /go/bin/accountingservice/ ./
33
+
34
+
13
35
14
36
# -----------------------------------------------------------------------------
15
37
@@ -19,4 +41,4 @@ WORKDIR /usr/src/app/
19
41
20
42
COPY --from=builder /go/bin/accountingservice/ ./
21
43
22
- ENTRYPOINT [ "./accountingservice" ]
44
+ ENTRYPOINT [ "./accountingservice" ]
You can’t perform that action at this time.
0 commit comments