# 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"]