Build your Go image | Docker Documentation

PHOTO EMBED

Tue Feb 08 2022 20:27:58 GMT+0000 (UTC)

Saved by @joel113 #go

# syntax=docker/dockerfile:1

# Alpine is chosen for its small footprint
# compared to Ubuntu
FROM golang:1.16-alpine

WORKDIR /app

# Download necessary Go modules
COPY go.mod ./
COPY go.sum ./
RUN go mod download

# ... the rest of the Dockerfile is ...
# ...   omitted from this example   ...
content_copyCOPY

https://docs.docker.com/language/golang/build-images/