Skip to content

Commit

Permalink
chore(deps): improve xmrig docker builds (#4273)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
leet4tari authored Jul 6, 2022
1 parent 1930140 commit 811f5a8
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions applications/launchpad/docker_rig/xmrig.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# 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 \
Expand All @@ -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 "\
Expand All @@ -58,4 +74,4 @@ RUN echo -e "\
}\
" > /home/tari/.xmrig.json

ENTRYPOINT [ "/usr/bin/xmrig" ]
ENTRYPOINT [ "/usr/local/bin/xmrig" ]

0 comments on commit 811f5a8

Please sign in to comment.