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
|
|
|
|
|
2022-01-05 01:27:35 +00:00
|
|
|
COPY . .
|
2021-12-25 05:49:07 +00:00
|
|
|
|
|
|
|
RUN set -ex \
|
2022-01-05 01:27:35 +00:00
|
|
|
&& go build -o redisLoadTest
|
2021-12-25 05:49:07 +00:00
|
|
|
|
|
|
|
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}"]
|