Skip to content

Commit

Permalink
Multi Stage Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
rblaine95 committed Oct 23, 2024
1 parent 78480c9 commit 1b6959b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
19 changes: 18 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/alpine:3
FROM docker.io/alpine:3 AS builder

ENV VERSION=6.22.1

Expand All @@ -8,6 +8,23 @@ RUN apk --no-cache --update upgrade && \
hwloc-dev numactl && \
rm -rf /var/cache/apk/

RUN git clone https://github.com/xmrig/xmrig.git --depth 1 -b v$VERSION && \
cd xmrig && \
sed -i -e 's/constexpr const int kMinimumDonateLevel = 1;/constexpr const int kMinimumDonateLevel = 0;/g' src/donate.h && \
mkdir build && \
cd build && \
cmake .. && \
make -j$(nproc)

FROM docker.io/alpine:3

RUN apk --no-cache --update upgrade && \
apk --no-cache --update add \
libuv-dev libmicrohttpd-dev \
openssl-dev hwloc-dev numactl && \
rm -rf /var/cache/apk/

COPY --from=builder /xmrig/build/xmrig /usr/local/bin/xmrig
COPY entrypoint.sh /usr/local/bin/xmrig.sh

ENTRYPOINT ["xmrig.sh"]
12 changes: 2 additions & 10 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,9 @@ fi

if [ -z "$algo" ]; then echo " Using --- $coin"; else echo " Using --- $algo"; fi

git clone https://github.com/xmrig/xmrig.git --depth 1 -b v$VERSION
cd xmrig
sed -i -e 's/constexpr const int kMinimumDonateLevel = 1;/constexpr const int kMinimumDonateLevel = 0;/g' src/donate.h
mkdir build
cd build
cmake ..
make -j$(nproc)

if [ -z "$algo" ]; then
echo -o $xmrpool:$startport -u $username -p $password -t $numthreads --coin=$coin --donate-level=$donate $OPTIONS
./xmrig -o $xmrpool:$startport \
xmrig -o $xmrpool:$startport \
-u $username \
-p $password \
-t $numthreads \
Expand All @@ -75,7 +67,7 @@ if [ -z "$algo" ]; then
$OPTIONS
else
echo -o $xmrpool:$startport -u $username -p $password -t $numthreads --algo=$algo --donate-level=$donate $OPTIONS
./xmrig -o $xmrpool:$startport \
xmrig -o $xmrpool:$startport \
-u $username \
-p $password \
-t $numthreads \
Expand Down

0 comments on commit 1b6959b

Please sign in to comment.