servcvgen/Dockerfile

23 lines
450 B
Docker

FROM golang:1.17.6 as builder
ENV GOOS linux
ENV CGO_ENABLED 0
# Add a work directory
WORKDIR /app
# Cache and install dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy app files
COPY . .
# Build app
RUN go build -o servgen
FROM alpine:3.15 as production
# Add certificates
RUN apk add --no-cache ca-certificates
# Copy built binary from builder
COPY --from=builder servgen .
# Expose port
#EXPOSE 8080
# Exec built binary
CMD ./servgen