2021-12-25 05:49:07 +00:00
|
|
|
FROM golang:1.17.5-bullseye AS builder
|
2021-12-26 23:49:52 +00:00
|
|
|
|
|
|
|
RUN mkdir /tmp/redisloadtest
|
|
|
|
|
|
|
|
WORKDIR /tmp/redisloadtest
|
|
|
|
|
2021-12-25 05:49:07 +00:00
|
|
|
COPY go.mod .
|
2021-12-26 23:49:52 +00:00
|
|
|
COPY go.sum .
|
2021-12-25 05:49:07 +00:00
|
|
|
COPY redisLoadTest.go .
|
|
|
|
|
|
|
|
RUN set -ex \
|
|
|
|
&& go build -o redisLoadTest redisLoadTest.go
|
|
|
|
|
|
|
|
FROM golang:1.17.5-bullseye AS redisloadtest
|
|
|
|
|
|
|
|
ENV USER=redisloadtest
|
|
|
|
ENV FILEPATH=/usr/local/bin/
|
|
|
|
ENV FILENAME=redisLoadTest
|
|
|
|
ENV HOME=/home/${USER}
|
|
|
|
|
|
|
|
RUN useradd ${USER} --home-dir ${HOME}
|
|
|
|
|
|
|
|
WORKDIR /tmp
|
|
|
|
|
|
|
|
# Copy the binary from the builder stage
|
2021-12-26 23:49:52 +00:00
|
|
|
COPY --from=builder /tmp/redisloadtest/${FILENAME} ./
|
2021-12-25 05:49:07 +00:00
|
|
|
|
|
|
|
RUN mv /tmp/${FILENAME} ${FILEPATH} \
|
|
|
|
&& chown ${USER}:${USER} ${FILEPATH}${FILENAME} \
|
2021-12-26 23:49:52 +00:00
|
|
|
&& chmod 4555 ${FILEPATH}${FILENAME} \
|
2021-12-25 05:49:07 +00:00
|
|
|
&& rm -rf -- /tmp/* \
|
|
|
|
|
|
|
|
WORKDIR ${HOME}
|
|
|
|
|
|
|
|
CMD ["${FILEPATH}${FILENAME}"]
|