forked from open-telemetry/opentelemetry-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
27 lines (18 loc) · 789 Bytes
/
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
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
FROM golang:1.22-alpine AS builder
WORKDIR /usr/src/app/
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,source=./src/checkoutservice/go.sum,target=go.sum \
--mount=type=bind,source=./src/checkoutservice/go.mod,target=go.mod \
go mod download
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=bind,rw,source=./src/checkoutservice,target=. \
go build -ldflags "-s -w" -o /go/bin/checkoutservice/ ./
FROM alpine AS release
WORKDIR /usr/src/app/
COPY ./src/checkoutservice/products/ ./products/
COPY --from=builder /go/bin/checkoutservice/ ./
EXPOSE ${CHECKOUT_SERVICE_PORT}
ENTRYPOINT [ "./checkoutservice" ]