feat: switch to alpine 3.20 (#11)

This commit is contained in:
Ismo Vuorinen
2024-08-12 22:58:53 +03:00
committed by GitHub
parent 82c98fc042
commit f8e9a104c8
4 changed files with 29 additions and 36 deletions

View File

@@ -11,4 +11,3 @@ insert_final_newline = true
max_line_length = 120 max_line_length = 120
indent_style = space indent_style = space
indent_size = 2 indent_size = 2

View File

@@ -1,46 +1,42 @@
ARG UBUNTU_VERSION="noble-20240605" # Stage 1: Build stage
ARG ALPINE_VERSION="3.20"
ARG XMRIG_VERSION="v6.22.0" ARG XMRIG_VERSION="v6.22.0"
FROM ubuntu:${UBUNTU_VERSION} as prepare FROM alpine:${ALPINE_VERSION} AS builder
ENV TZ=Europe/Helsinki # Install build dependencies
ENV PATH=/xmrig:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUN echo 'https://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories && \
ENV XMRIG_URL=https://github.com/xmrig/xmrig.git apk --no-cache add git build-base linux-headers cmake libuv-dev openssl-dev hwloc-dev gcompat
RUN DEBIAN_FRONTEND=noninteractive \ # Clone the specific version of XMRig
apt-get update && \ RUN git clone https://github.com/xmrig/xmrig.git /xmrig && \
apt-get -y install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev cd /xmrig && git checkout ${XMRIG_VERSION}
RUN git clone ${XMRIG_URL} /xmrig && \ # Modify the source code
cd /xmrig && git checkout ${XMRIG_VERSION} RUN sed -i 's/1;/0;/g' /xmrig/src/donate.h
# Build XMRig
WORKDIR /xmrig/build WORKDIR /xmrig/build
RUN sed -i 's/1;/0;/g' ../src/donate.h
RUN cmake .. -DWITH_OPENCL=OFF -DWITH_CUDA=OFF && make -j$(nproc) RUN cmake .. -DWITH_OPENCL=OFF -DWITH_CUDA=OFF && make -j$(nproc)
COPY config.json /xmrig/build/conf/ # Stage 2
FROM alpine:${ALPINE_VERSION}
###
FROM ubuntu:${UBUNTU_VERSION}
ARG XMRIG_VERSION
ARG BUILD_DATE ARG BUILD_DATE
ARG VCS_REF ARG VCS_REF
ARG XMRIG_VERSION
LABEL org.label-schema.build-date=$BUILD_DATE \ LABEL org.label-schema.schema-version="1.0" \
org.label-schema.vcs-url="https://github.com/ivuorinen/docker-xmrig" \ org.label-schema.build-date=$BUILD_DATE \
org.label-schema.vcs-ref=$VCS_REF \ org.label-schema.vcs-url="https://github.com/ivuorinen/docker-xmrig" \
org.label-schema.schema-version=$XMRIG_VERSION 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=builder /xmrig/build/xmrig /bin/xmrig
COPY --from=prepare /xmrig/build/xmrig /xmrig/xmrig COPY config.json /etc/xmrig/config.json
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
CMD ["/xmrig/xmrig", "-c", "/xmrig/config.json"] CMD ["/bin/xmrig", "-c", "/etc/xmrig/config.json"]

View File

@@ -29,9 +29,9 @@
"loader": null, "loader": null,
"nvml": true "nvml": true
}, },
"log-file": "/log/xmrig.log",
"donate-level": 0, "donate-level": 0,
"donate-over-proxy": 0, "donate-over-proxy": 0,
"log-file": "/xmrig/log/xmrig.log",
"pools": [ "pools": [
{ {
"url": "tunkki:3333", "url": "tunkki:3333",

View File

@@ -1,4 +1,3 @@
version: "3.8"
services: services:
xmrig: xmrig:
image: ivuorinen/docker-xmrig:latest image: ivuorinen/docker-xmrig:latest
@@ -6,9 +5,8 @@ services:
#environment: #environment:
# - TZ=Europe/Amsterdam # - TZ=Europe/Amsterdam
volumes: volumes:
- ./config.json:/xmrig/etc/config.json:rw - ./config.json:/etc/xmrig/config.json:rw
- ./log:/xmrig/log - ./log:/xmrig/log:rw
command: ["/xmrig/xmrig", "--config=/xmrig/etc/config.json"]
restart: unless-stopped restart: unless-stopped
watchtower: watchtower:
image: containrrr/watchtower image: containrrr/watchtower