Line-by-line explanation

Dockerfile syntax

# syntax=docker/dockerfile:1

Enables modern Dockerfile features & better caching behaviour. Safe default.


Stage 1: Build stage

Base image for compilation

FROM golang:1.22-alpine AS builder

Working directory

WORKDIR /src

All subsequent commands run inside /src.

Install build-time packages

RUN apk add --no-cache ca-certificates git