mirror of
https://github.com/ivuorinen/docker-xmrig.git
synced 2026-02-12 22:48:22 +00:00
feat: switch to alpine 3.20 (#11)
This commit is contained in:
56
Dockerfile
56
Dockerfile
@@ -1,46 +1,42 @@
|
||||
ARG UBUNTU_VERSION="noble-20240605"
|
||||
# Stage 1: Build stage
|
||||
ARG ALPINE_VERSION="3.20"
|
||||
ARG XMRIG_VERSION="v6.22.0"
|
||||
|
||||
FROM ubuntu:${UBUNTU_VERSION} as prepare
|
||||
FROM alpine:${ALPINE_VERSION} AS builder
|
||||
|
||||
ENV TZ=Europe/Helsinki
|
||||
ENV PATH=/xmrig:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
ENV XMRIG_URL=https://github.com/xmrig/xmrig.git
|
||||
# Install build dependencies
|
||||
RUN echo 'https://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories && \
|
||||
apk --no-cache add git build-base linux-headers cmake libuv-dev openssl-dev hwloc-dev gcompat
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive \
|
||||
apt-get update && \
|
||||
apt-get -y install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
|
||||
# Clone the specific version of XMRig
|
||||
RUN git clone https://github.com/xmrig/xmrig.git /xmrig && \
|
||||
cd /xmrig && git checkout ${XMRIG_VERSION}
|
||||
|
||||
RUN git clone ${XMRIG_URL} /xmrig && \
|
||||
cd /xmrig && git checkout ${XMRIG_VERSION}
|
||||
# Modify the source code
|
||||
RUN sed -i 's/1;/0;/g' /xmrig/src/donate.h
|
||||
|
||||
# Build XMRig
|
||||
WORKDIR /xmrig/build
|
||||
RUN sed -i 's/1;/0;/g' ../src/donate.h
|
||||
RUN cmake .. -DWITH_OPENCL=OFF -DWITH_CUDA=OFF && make -j$(nproc)
|
||||
|
||||
COPY config.json /xmrig/build/conf/
|
||||
|
||||
###
|
||||
FROM ubuntu:${UBUNTU_VERSION}
|
||||
# Stage 2
|
||||
FROM alpine:${ALPINE_VERSION}
|
||||
|
||||
ARG XMRIG_VERSION
|
||||
ARG BUILD_DATE
|
||||
ARG VCS_REF
|
||||
ARG XMRIG_VERSION
|
||||
|
||||
LABEL org.label-schema.build-date=$BUILD_DATE \
|
||||
org.label-schema.vcs-url="https://github.com/ivuorinen/docker-xmrig" \
|
||||
org.label-schema.vcs-ref=$VCS_REF \
|
||||
org.label-schema.schema-version=$XMRIG_VERSION
|
||||
LABEL org.label-schema.schema-version="1.0" \
|
||||
org.label-schema.build-date=$BUILD_DATE \
|
||||
org.label-schema.vcs-url="https://github.com/ivuorinen/docker-xmrig" \
|
||||
org.label-schema.vcs-ref=$VCS_REF \
|
||||
org.label-schema.version=${XMRIG_VERSION}
|
||||
|
||||
WORKDIR /xmrig
|
||||
RUN apk --no-cache add libuv hwloc gcompat && \
|
||||
rm -rf /var/cache/apk/* && \
|
||||
mkdir -p /etc/xmrig /log
|
||||
|
||||
COPY --from=prepare /xmrig/build/conf/config.json /xmrig/config.json
|
||||
COPY --from=prepare /xmrig/build/xmrig /xmrig/xmrig
|
||||
RUN DEBIAN_FRONTEND=noninteractive \
|
||||
apt-get update \
|
||||
&& apt-get -y --no-install-recommends install libuv1 libhwloc15 \
|
||||
&& apt-get purge -y --auto-remove \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& mkdir /xmrig/log
|
||||
COPY --from=builder /xmrig/build/xmrig /bin/xmrig
|
||||
COPY config.json /etc/xmrig/config.json
|
||||
|
||||
CMD ["/xmrig/xmrig", "-c", "/xmrig/config.json"]
|
||||
CMD ["/bin/xmrig", "-c", "/etc/xmrig/config.json"]
|
||||
|
||||
Reference in New Issue
Block a user