Files
devops-directive-docker-course/06-building-container-images/api-golang/Dockerfile.3

17 lines
347 B
Docker

# Pin specific version for stability
# Use alpine for reduced image size
FROM golang:1.19-alpine
WORKDIR /app
# Copy only files required to install dependencies (better layer caching)
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Compile application during build rather than at runtime
RUN go build -o api-golang
CMD ["./api-golang"]