forked from Scottcjn/Rustchain
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.miner
More file actions
58 lines (44 loc) · 1.5 KB
/
Dockerfile.miner
File metadata and controls
58 lines (44 loc) · 1.5 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
55
56
57
58
# RustChain Python Miner Dockerfile
# Note: Docker miners earn reduced rewards due to anti-VM detection
# For full rewards, run the miner directly on physical hardware
FROM python:3.11-slim
LABEL maintainer="RustChain Community"
LABEL description="RustChain Proof-of-Antiquity Miner"
LABEL version="1.1.0"
# Build argument for miner type
ARG MINER_TYPE=linux
ARG MINER_ARCH=x86_64
# Environment variables
ENV PYTHONUNBUFFERED=1 \
WALLET_NAME="" \
NODE_URL="https://rustchain.org" \
BLOCK_TIME=600 \
MINER_TYPE=${MINER_TYPE} \
MINER_ARCH=${MINER_ARCH}
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
curl \
dmidecode \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /app
# Copy requirements and install Python dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy miner files
COPY miners/ ./miners/
COPY wallet/ ./wallet/
# Copy entrypoint script (must happen before USER switch)
COPY docker-miner-entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Create a non-root user (security best practice)
RUN useradd -m -u 1000 rustchain && \
chown -R rustchain:rustchain /app
USER rustchain
# Health check - verify the node is reachable
HEALTHCHECK --interval=5m --timeout=30s --start-period=1m --retries=3 \
CMD curl -fsk ${NODE_URL}/health || exit 1
ENTRYPOINT ["/entrypoint.sh"]
# Default: run Linux miner
CMD ["python3", "-u", "miners/linux/rustchain_linux_miner.py"]