FROM golang:1.23-alpine

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

# Install Air for hot reload
RUN go install github.com/cosmtrek/air@latest

# Install sqlc
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest

# Install migrate
RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest

WORKDIR /app

# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download

# Copy source code
COPY . .

EXPOSE 8080

CMD ["air", "-c", ".air.toml"]
