The simplest Golang Dockerfile Setup

Words
50
Reading
1 min
4y
Listen to this post
~1 min

FROM golang:1.16.7-alpine AS builder

git is needed to download those packages

use this if u called to any https service

RUN apk --update add --no-cache ca-certificates openssl git && update-ca-certificates

without ssl

RUN apk --update add --no-cache git
WORKDIR /app
copy go.mod ./
copy go.sum ./
RUN go mod download