<filename>Dockerfile
FROM golang:latest as builder


# Set Environment Variables
ENV CGO_ENABLED 0
ENV GOOS linux


#Add Maintainer Label

WORKDIR /app
COPY go.mod go.sum ./

RUN go mod download 

#Adds source code
ADD cmd cmd
ADD pkg pkg

# Build the application
RUN go build -a -installsuffix cgo -o main cmd/server/main.go

#Start a new stage from scratch 
FROM alpine:latest
RUN apk --no-cache add ca-certificates

WORKDIR /root/

#Copy the prebuilt binary from the previous stage.
COPY --from=builder /app/main .   

EXPOSE 80


#Command to run the executable
CMD ["./main"]