# syntax=docker/dockerfile:experimental

FROM golang:1.25.5-alpine3.23 as dev
RUN apk add --no-cache git ca-certificates
RUN adduser -D appuser
COPY . /src/
WORKDIR /src

ENV GO111MODULE=on
RUN --mount=type=cache,sharing=locked,id=gomod,target=/go/pkg/mod/cache \
    --mount=type=cache,sharing=locked,id=goroot,target=/root/.cache/go-build \
    CGO_ENABLED=0 GOOS=linux go build -ldflags '-s -w -extldflags -static' -o e2eClient /src/main.go

FROM scratch
COPY --from=dev /src/e2eClient /
CMD ["/e2eClient"]
