FROM golang:1.26.2-trixie

WORKDIR /app

# Install git for go mod download if needed
RUN apt-get update \
	&& apt-get install -y --no-install-recommends git ca-certificates \
	&& rm -rf /var/lib/apt/lists/*

# Pre-copy go.mod/sum to cache dependencies
COPY go.mod go.sum ./
RUN go mod download

# Copy source
COPY . .

# Build for production (optional, can just run go run for dev)
RUN go build -o main ./cmd/server

EXPOSE 3000

# Default command (can be overridden by compose)
CMD ["./main"]
