multistage docker build
This commit is contained in:
parent
2266a0bab5
commit
11508b2017
|
@ -1,13 +1,15 @@
|
||||||
FROM golang:1.18-alpine
|
FROM golang:1.18-alpine as build
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY go.mod ./
|
COPY go.mod ./
|
||||||
COPY go.sum ./
|
COPY go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
ADD . .
|
ADD . .
|
||||||
|
|
||||||
RUN go build -o /gte-daemon ./cmd/daemon/service.go
|
RUN go build -o /gte-daemon ./cmd/daemon/service.go
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
RUN apk add ca-certificates
|
||||||
|
COPY --from=build /gte-daemon /gte-daemon
|
||||||
CMD ["/gte-daemon"]
|
CMD ["/gte-daemon"]
|
||||||
|
|
Loading…
Reference in New Issue