From 2f0c85eb6f118289562041ddc9ff2c387b24e201 Mon Sep 17 00:00:00 2001 From: RaviAnand Mohabir Date: Thu, 26 Oct 2023 20:38:28 +0200 Subject: [PATCH] build: :building_construction: use Docker multi-stage build --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5672384..f164271 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21 +FROM golang:1.21 as build # Set destination for COPY WORKDIR /app @@ -14,6 +14,10 @@ COPY . ./ # Build RUN CGO_ENABLED=0 GOOS=linux go build -o /listy +FROM alpine + +COPY --from=build /listy /listy + # Optional: # To bind to a TCP port, runtime parameters must be supplied to the docker command. # But we can document in the Dockerfile what ports