Skip to content

Commit 5b4d624

Browse files
committed
Testing out stripped down dockerfile
1 parent 378bf38 commit 5b4d624

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

src/productcatalogservice/Dockerfile

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

73
WORKDIR /usr/src/app/
8-
USER root
4+
95
RUN apk update \
106
&& apk add --no-cache make protobuf-dev
117

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

2613
FROM registry.ddbuild.io/images/mirror/alpine:latest AS release
2714

0 commit comments

Comments
 (0)