Skip to content

Commit 8d16626

Browse files
committed
Updating to match upstream
1 parent b5f138e commit 8d16626

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/productcatalogservice/Dockerfile

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
14
FROM registry.ddbuild.io/images/mirror/golang:1.22-alpine AS builder
25

36
WORKDIR /usr/src/app/
47

5-
RUN apk add build-base protobuf-dev protoc
6-
78
RUN apk update \
89
&& apk add --no-cache make protobuf-dev
910

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

14-
# -----------------------------------------------------------------------------
1525
FROM registry.ddbuild.io/images/mirror/alpine:latest AS release
1626

1727
WORKDIR /usr/src/app/

0 commit comments

Comments
 (0)