FROM golang:1.25-alpine AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o /caltrack .

FROM alpine:3.21
RUN apk add --no-cache ca-certificates tzdata
COPY --from=build /caltrack /usr/local/bin/caltrack
RUN mkdir -p /data
ENV HOME=/data
EXPOSE 8080
ENTRYPOINT ["caltrack"]
