chore(deps): improve xmrig docker builds
Description
Bump xmrig version installed, add curl for internal healthcheck for docker, env updates
How Has This Been Tested?
Build in quay for intel and arm
Tested on Mac Intel and Raspberry Pi
# Source build
-FROM alpine:latest as builder
+
+ARG ALPINE_VERSION=3.16
+
+FROM alpine:$ALPINE_VERSION as builder
# Declare to make available
+ARG ALPINE_VERSION
ARG BUILDPLATFORM
# https://github.com/xmrig/xmrig/releases
-ARG XMRIG_VERSION="v6.17.0"
+ARG XMRIG_VERSION="v6.18.0"
+ARG VERSION=1.0.1
RUN apk add \
git \
@@ -29,21 +34,32 @@ RUN cmake .. -DXMRIG_DEPS=scripts/deps -DBUILD_STATIC=ON
RUN make -j$(nproc)
# Create runtime base minimal image for the target platform executables
-FROM --platform=$TARGETPLATFORM alpine:latest as runtime
+FROM --platform=$TARGETPLATFORM alpine:$ALPINE_VERSION as runtime
+ARG ALPINE_VERSION
ARG BUILDPLATFORM
ARG XMRIG_VERSION
-ARG VERSION=1.0.1
-COPY --from=builder /xmrig/build/xmrig /usr/bin/
+ARG VERSION
+
+# Add curl for http healthcheck
+RUN apk update && \
+ apk upgrade && \
+ apk add curl && \
+ rm /var/cache/apk/*
+
+# Create a user & group & chown all the files to the app user
+RUN addgroup -g 1000 tari && \
+ adduser -u 1000 -g 1000 -S tari -G tari && \
+ mkdir -p /home/tari && \
+ chown tari:tari /home/tari
+
+COPY --chown=tari:tari --from=builder /xmrig/build/xmrig /usr/local/bin/
-# Create a user & group
-RUN addgroup -g 1000 tari && adduser -u 1000 -g 1000 -S tari -G tari
-RUN mkdir -p /home/tari && chown tari.tari /home/tari
-# Chown all the files to the app user.
USER tari
ENV dockerfile_version=$VERSION
ENV dockerfile_build_arch=$BUILDPLATFORM
+ENV alpine_version=$ALPINE_VERSION
ENV xmrig_version=$XMRIG_VERSION
RUN echo -e "\
@@ -58,4 +74,4 @@ RUN echo -e "\
}\
" > /home/tari/.xmrig.json
-ENTRYPOINT [ "/usr/bin/xmrig" ]
+ENTRYPOINT [ "/usr/local/bin/xmrig" ]
