ARG LIBUV_VERSION=1.38.0 ARG OPENSSL_VERSION=1.1.1g ARG HWLOC_VERSION=2.2.0 ARG XMRIG_VERSION=6.3.0 FROM alpine:3.12 AS builder ARG LIBUV_VERSION ARG OPENSSL_VERSION ARG HWLOC_VERSION ARG XMRIG_VERSION RUN apk add --no-cache \ autoconf \ automake \ build-base \ cmake \ libtool \ linux-headers \ m4 # Build OpenSSL. WORKDIR /workdir/openssl ADD https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \ openssl-${OPENSSL_VERSION}.tar.gz RUN tar xvf openssl-${OPENSSL_VERSION}.tar.gz WORKDIR openssl-${OPENSSL_VERSION} RUN ./config \ -no-asm \ -no-cms \ -no-comp \ -no-dgram \ -no-filenames \ -no-shared \ -no-zlib \ && make -j$(nproc) \ && make install_sw # Build hwloc WORKDIR /workdir/hwloc ADD https://download.open-mpi.org/release/hwloc/v2.2/hwloc-${HWLOC_VERSION}.tar.gz \ hwloc-${HWLOC_VERSION}.tar.gz RUN tar xvf hwloc-${HWLOC_VERSION}.tar.gz WORKDIR hwloc-${HWLOC_VERSION} RUN ./configure \ --disable-dependency-tracking \ --disable-io \ --disable-libudev \ --disable-libxml2 \ --disable-shared \ --enable-static \ && make -j$(nproc) \ && make install # Build libuv WORKDIR /workdir/libuv ADD https://github.com/libuv/libuv/archive/v${LIBUV_VERSION}.tar.gz \ libuv-${LIBUV_VERSION}.tar.gz RUN tar xvf libuv-${LIBUV_VERSION}.tar.gz WORKDIR libuv-${LIBUV_VERSION} RUN ./autogen.sh \ && ./configure \ --disable-shared \ && make -j$(nproc) \ && make install # Build XMRig. WORKDIR /workdir/xmrig ADD https://github.com/xmrig/xmrig/archive/v${XMRIG_VERSION}.tar.gz \ xmrig-${XMRIG_VERSION}.tar.gz RUN tar xvf xmrig-${XMRIG_VERSION}.tar.gz WORKDIR xmrig-${XMRIG_VERSION} COPY patches/ patches/ RUN cat patches/*.patch | patch -p1 \ && cmake \ -Bbuild \ -DBUILD_STATIC=On \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_EXE_LINKER_FLAGS='-static -static-libgcc' \ -DCMAKE_FIND_LIBRARY_SUFFIXES=.a \ -DOPENSSL_USE_STATIC_LIBS=On \ -DWITH_OPENCL=Off \ -DWITH_CUDA=Off \ && make \ -Cbuild \ -j$(nproc) FROM scratch ARG XMRIG_VERSION LABEL maintainer="Matt Smith " COPY --from=builder /workdir/xmrig/xmrig-${XMRIG_VERSION}/build/xmrig /xmrig ENTRYPOINT ["/xmrig"]