File size: 1,538 Bytes
ea2a165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cca7387
 
 
 
ea2a165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cca7387
 
ea2a165
 
cca7387
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
# Use official Python runtime as base image
FROM python:3.13

# Set working directory
WORKDIR /app

# Install system dependencies and build tools
RUN apt-get update && apt-get install -y \

    build-essential \
    curl \
    wget \
    unzip \
    gcc \
    g++ \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements.txt
COPY requirements.txt .

# Install Python dependencies using pre-built wheels only
RUN pip install --no-cache-dir --only-binary :all: -r requirements.txt

# Copy the server application
COPY xmrig_server.py .

# Copy the launcher script
COPY xmrig_launcher.py .

# Copy static files for the web UI
COPY static ./static

# Create xmrig directory with write permissions
RUN mkdir -p /app/xmrig

# Download and extract XMRig (Linux version)
# RUN cd /app/xmrig && \
#     wget -q https://github.com/xmrig/xmrig/releases/download/v6.21.0/xmrig-6.21.0-linux-static-x64.tar.gz -O xmrig.tar.gz && \
#     tar -xzf xmrig.tar.gz && \
#     rm xmrig.tar.gz && \
#     chmod +x xmrig-6.21.0/xmrig && \
#     ls -la xmrig-6.21.0/ | head -20

# Set permissions for all app files
RUN chmod -R 777 /app

# Expose port 8000 for the web server
EXPOSE 8000

# Run as root (default in Docker) for admin privileges
USER root

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \

    CMD curl -f http://localhost:8000/health || exit 1

# Start the server with uvicorn
CMD ["uvicorn", "xmrig_server:app", "--host", "0.0.0.0", "--port", "8000"]