# syntax=docker/dockerfile:1.6

FROM golang:1.21-alpine AS build
WORKDIR /src
COPY go.mod ./
COPY internal ./internal
COPY jobs ./jobs
COPY main.go ./
RUN --mount=type=cache,target=/root/.cache/go-build \
    CGO_ENABLED=0 GOOS=linux go build -o /out/fetcher .

FROM gcr.io/distroless/base-debian12
WORKDIR /app
COPY --from=build /out/fetcher /app/fetcher
ENV COC_API_TOKEN="" \
    COC_CLAN_TAG="" \
    DISCORD_BOT_TOKEN="" \
    DISCORD_RECIPIENT_ID=""
ENTRYPOINT ["/app/fetcher"]
