# Build stage
FROM golang:1.24.5-alpine AS builder

WORKDIR /app

# Install dependencies
RUN apk add --no-cache git

# Download dependencies
COPY go.mod go.sum ./
RUN go mod download

# Copy source code
COPY . .

# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -o fotbal-club

# Final stage
FROM alpine:latest

WORKDIR /app

# Copy the binary from builder
COPY --from=builder /app/fotbal-club .

# Copy templates and static files if any
COPY ./templates ./templates
COPY ./static ./static

# Expose port
EXPOSE 8080

# Command to run the executable
CMD ["./fotbal-club"]
