From 788e1bb1209b470c41da881b6992288f81667bb7 Mon Sep 17 00:00:00 2001 From: RaviAnand Mohabir Date: Thu, 26 Oct 2023 20:24:40 +0200 Subject: [PATCH] build: :building_construction: add Dockerfile --- Dockerfile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..191462e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM golang:1.21 + +# Set destination for COPY +WORKDIR /app + +# Download Go modules +COPY go.mod go.sum ./ +RUN go mod download + +# Copy the source code. Note the slash at the end, as explained in +# https://docs.docker.com/engine/reference/builder/#copy +COPY *.go ./ + +# Build +RUN CGO_ENABLED=0 GOOS=linux go build -o /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 +# the application is going to listen on by default. +# https://docs.docker.com/engine/reference/builder/#expose +EXPOSE 5001 + +# Run +CMD ["/listy"]