# Build stage
FROM golang:1.25-alpine AS build

WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o podstalk .

# Runtime stage
FROM alpine:3.21

RUN apk add --no-cache ca-certificates
COPY --from=build /app/podstalk /usr/local/bin/podstalk

RUN mkdir -p /data /uploads
VOLUME /data /uploads

ENV PODSTALK_DB=/data/podstalk.db
ENV PODSTALK_UPLOAD_DIR=/uploads
ENV PORT=8080

EXPOSE 8080

ENTRYPOINT ["/usr/local/bin/podstalk"]
