# Use the official Golang image as the base. FROM golang:1.25-alpine AS base # Install git (required by go modules) and any other utilities. RUN apk add --no-cache git # Set the working directory inside the container. WORKDIR /app # Install Air (live‑reload tool for Go). ENV PATH="/go/bin:${PATH}" RUN go install github.com/air-verse/air@latest # Cache go.mod and go.sum to speed up dependency installation. COPY go.mod go.sum ./ RUN go mod download # Copy the rest of the source code. COPY . . # Use Air to watch source files and run the app. CMD ["air", "-c", ".air.toml"]