redisLoadTest/Dockerfile

33 lines
664 B
Docker
Raw Permalink Normal View History

2021-12-25 05:49:07 +00:00
FROM golang:1.17.5-bullseye AS builder
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
COPY --from=builder /tmp/redisloadtest/${FILENAME} ./
2021-12-25 05:49:07 +00:00
RUN mv /tmp/${FILENAME} ${FILEPATH} \
&& chown ${USER}:${USER} ${FILEPATH}${FILENAME} \
&& chmod 4555 ${FILEPATH}${FILENAME} \
2021-12-25 05:49:07 +00:00
&& rm -rf -- /tmp/* \
WORKDIR ${HOME}
CMD ["${FILEPATH}${FILENAME}"]