-
Notifications
You must be signed in to change notification settings - Fork 37
/
dockerfile.samplesvc
16 lines (15 loc) · 971 Bytes
/
dockerfile.samplesvc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
FROM golang:1.22.3
ARG version
COPY go.* /go/src/github.com/flowerinthenight/golang-monorepo/
COPY pkg/ /go/src/github.com/flowerinthenight/golang-monorepo/pkg/
COPY vendor/ /go/src/github.com/flowerinthenight/golang-monorepo/vendor/
COPY services/samplesvc/ /go/src/github.com/flowerinthenight/golang-monorepo/services/samplesvc/
WORKDIR /go/src/github.com/flowerinthenight/golang-monorepo/services/samplesvc/
RUN echo "HOME=$HOME"
RUN GO111MODULE=on GOFLAGS=-mod=vendor CGO_ENABLED=0 GOOS=linux go build -v -ldflags "-X github.com/flowerinthenight/golang-monorepo/services/samplesvc/main.version=$version" -a -installsuffix cgo -o samplesvc .
FROM debian:stable-slim
RUN set -x && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /samplesvc/
COPY --from=0 /go/src/github.com/flowerinthenight/golang-monorepo/services/samplesvc .
ENTRYPOINT ["/samplesvc/samplesvc"]
CMD ["run", "--logtostderr"]