Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): improve xmrig docker builds #4273

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" ]