# --- build stage ---
FROM golang:1.26-alpine AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# 정적 바이너리 (CGO 끔), 디버그 심볼 제거로 크기 축소. 템플릿은 go:embed로 포함됨.
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /out/slack-notifier .

# --- run stage (distroless static, ~2MB 베이스) ---
FROM gcr.io/distroless/static-debian12
WORKDIR /app
COPY --from=build /out/slack-notifier /app/slack-notifier
ENV ADDR=:8000
ENV MAPPING_FILE=/app/data/mappings.json
ENV LOG_FILE=/app/logs/app.log
EXPOSE 8000
ENTRYPOINT ["/app/slack-notifier"]
