Skip to content

Commit 406ddfe

Browse files
committed
Trying to update accountingservice
1 parent 59b8757 commit 406ddfe

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

src/accountingservice/Dockerfile

+7-19
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,21 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44

5-
FROM registry.ddbuild.io/images/mirror/golang:1.22-alpine AS builder
6-
7-
WORKDIR /usr/src/app
8-
RUN chmod 700 /usr/src/app
5+
FROM golang:1.21.4-alpine AS builder
6+
WORKDIR /usr/src/app/
97

108
RUN apk update \
119
&& apk add --no-cache make protobuf-dev
10+
11+
COPY ./src/accountingservice/ ./
12+
RUN go build -o /go/bin/accountingservice/
1213

13-
14-
RUN --mount=type=cache,target=/go/pkg/mod/ \
15-
--mount=type=bind,source=./src/accountingservice/go.sum,target=go.sum \
16-
--mount=type=bind,source=./src/accountingservice/go.mod,target=go.mod \
17-
--mount=type=bind,source=./src/accountingservice/tools.go,target=tools.go \
18-
go mod download \
19-
&& go list -e -f '{{range .Imports}}{{.}} {{end}}' tools.go | CGO_ENABLED=0 xargs go install -mod=readonly
20-
21-
RUN --mount=type=cache,target=/go/pkg/mod/ \
22-
--mount=type=cache,target=/root/.cache/go-build \
23-
--mount=type=bind,rw,source=./src/accountingservice,target=. \
24-
--mount=type=bind,rw,source=./pb,target=./pb \
25-
protoc -I ./pb ./pb/demo.proto --go_out=./ --go-grpc_out=./ \
26-
&& go build -ldflags "-s -w" -o /go/bin/accountingservice/ ./
14+
# -----------------------------------------------------------------------------
2715

2816
FROM alpine
2917

3018
WORKDIR /usr/src/app/
3119

3220
COPY --from=builder /go/bin/accountingservice/ ./
3321

34-
ENTRYPOINT [ "./accountingservice" ]
22+
ENTRYPOINT [ "./accountingservice" ]

0 commit comments

Comments
 (0)