multistage docker build

This commit is contained in:
Erik Winter 2022-09-22 11:57:11 +02:00
parent 2266a0bab5
commit 11508b2017
1 changed files with 5 additions and 3 deletions

View File

@ -1,13 +1,15 @@
FROM golang:1.18-alpine
FROM golang:1.18-alpine as build
WORKDIR /app
COPY go.mod ./
COPY go.sum ./
RUN go mod download
ADD . .
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"]