# Development image for the Go backend. `docker-compose up` bind-mounts the
# source and runs `go run main.go`, so this image only needs the toolchain.
FROM golang:1.27-alpine

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

ENV CGO_ENABLED=0 \
    GOFLAGS=-mod=mod

WORKDIR /app/backend

# Warm the module cache before the bind mount replaces the working directory.
COPY go.mod ./
RUN go mod download || true

EXPOSE 8080

CMD ["go", "run", "main.go", "-addr", "0.0.0.0:8080"]