From 0de6da3e727ba69a8b4cf40cf39160ecc4a9ea48 Mon Sep 17 00:00:00 2001 From: Salvatore Olivieri <99086797+salvatoreolivieri@users.noreply.github.com> Date: Wed, 13 Nov 2024 19:06:24 +0100 Subject: [PATCH] create dockerfile --- Dockerfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b1a4a75 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# The build stage +FROM golang:1.22 as builder +WORKDIR /app +COPY . . +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o api cmd/api/*.go + +# The run stage +FROM scratch +WORKDIR /app +# Copy CA certificates +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY --from=builder /app/api . +EXPOSE 8080 +CMD ["./api"] \ No newline at end of file