FROM golang as builder

WORKDIR /app
COPY stress.go .

RUN go mod init stress
RUN go mod tidy
RUN go get .
RUN go build -o stress .
RUN chmod +x stress

FROM ubuntu as runner

COPY --from=builder /app/stress .

RUN apt-get update

RUN apt-get install -y curl

RUN useradd -m -s /bin/bash stress

USER stress

CMD ["./stress"]