-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (46 loc) · 1.58 KB
/
Copy pathDockerfile
File metadata and controls
54 lines (46 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
FROM alpine:3.14.1 as xmrig-builder
RUN apk add git make cmake libstdc++ gcc g++ automake libtool autoconf linux-headers
ARG XMRIG_VERSION=6.22.2-mo1
RUN git clone https://github.com/moneroocean/xmrig.git --branch v${XMRIG_VERSION}
RUN mkdir xmrig/build \
&& cd xmrig/scripts \
&& sed -i 's/DonateLevel=1/DonateLevel=0/g' /xmrig/src/donate.h \
&& ./build_deps.sh \
&& cd ../build \
&& cmake .. -DXMRIG_DEPS=scripts/deps \
-DBUILD_STATIC=ON \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_OPENCL=OFF \
-DWITH_CUDA=OFF \
&& make -j$(nproc)
FROM golang:alpine3.14 as server-builder
WORKDIR /app
COPY server/*.go ./
RUN go build -ldflags="-s -w" -o /server main.go
FROM alpine:3.14.1 as compressor
RUN apk add upx
WORKDIR /staging
COPY --from=server-builder /server ./
COPY --from=xmrig-builder /xmrig/build/xmrig ./
RUN upx ./server
RUN upx ./xmrig
FROM alpine:3.14.1 as xmrig-workers-builder
RUN apk add git npm
RUN git clone https://github.com/xmrig/xmrig-workers
WORKDIR /xmrig-workers
RUN sed -i 's/createBrowser/createHash/g' ./src/store/history.js
RUN npm install
RUN rm /xmrig-workers/public/assets/js/app* /xmrig-workers/public/assets/css/app*
RUN npm run build
FROM alpine:3.14.1
ENV PGID=1000 \
PUID=1000 \
XMRIG_API_ENABLED=true \
XMRIG_WORKERS_AUTOCONFIGURE=true \
XMRIG_WORKERS_ENABLED=true
RUN mkdir /xmrig-workers
COPY --from=compressor /staging/server /xmrig-workers/server
COPY --from=xmrig-workers-builder /xmrig-workers/public /xmrig-workers/www
COPY --from=compressor /staging/xmrig /usr/local/bin/xmrig
COPY rootfs /
ENTRYPOINT ["/entrypoint.sh"]