# Use official Go image with specific version
FROM golang:1.25.1

# Set working directory
WORKDIR /app

# Copy Go module files first
COPY go.mod go.sum ./

# Download dependencies
RUN go mod download

# Copy source code
COPY *.go ./

# Build the binary
RUN CGO_ENABLED=0 GOOS=linux go build -o main .

# Expose port
EXPOSE 8080

# Run the application
CMD ["./main"]