FROM golang:1.21
WORKDIR /src
COPY . .
RUN go build -o /src/ci-wrapper ./main.go

FROM alpine:3.19
COPY --from=0 /src/ci-wrapper /bin/ci-wrapper
COPY --chmod=555 entrypoint.sh /bin/entrypoint.sh
RUN apk add --no-cache git

ENTRYPOINT ["ash", "/bin/entrypoint.sh"]