# ---------- Build Stage ----------
FROM golang:1.24 AS builder

WORKDIR /app
COPY . .

RUN CGO_ENABLED=0 GOOS=linux go build -o server

# ---------- Runtime Stage ----------
FROM alpine:latest
RUN apk add --no-cache tzdata
WORKDIR /app

COPY --from=builder /app/server /app
COPY nearle-gear-firebase-adminsdk-l9oha-23ca3b3609.json .

# No `.env.*` is copied in (see .dockerignore), so this only decides which
# rules config.Load applies: production insists on a signing secret and never
# falls back to localhost values. Every real value comes from the platform's
# environment settings.
ENV APP_ENV=production

# Must match APP_PORT in the platform's environment (1009 in production).
EXPOSE 1009

CMD ["/app/server"]
