Skip to content

Commit ed90a59

Browse files
authored
Merge pull request #61 from hashtopolis/agent-docker
First dockerization possibilities for agent
2 parents e2e7acb + 0aebcf6 commit ed90a59

3 files changed

Lines changed: 65 additions & 0 deletions

File tree

Dockerfile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
FROM alpine/git AS preprocess
2+
3+
RUN apk add --no-cache bash zip
4+
5+
COPY . /htp
6+
7+
RUN cd /htp && bash build.sh && ls /htp
8+
9+
FROM nvidia/cuda:12.3.2-devel-ubuntu22.04 AS agent-cuda
10+
11+
ENV APPDIR=/htp
12+
13+
WORKDIR ${APPDIR}
14+
15+
RUN \
16+
--mount=type=cache,target=/var/cache/apt \
17+
apt-get update && apt-get install -y --no-install-recommends \
18+
zip \
19+
p7zip-full \
20+
git \
21+
python3 \
22+
python3-pip \
23+
python3-psutil \
24+
python3-requests \
25+
pciutils \
26+
ca-certificates \
27+
rsync \
28+
ocl-icd-libopencl1 \
29+
clinfo \
30+
curl && \
31+
rm -rf /var/lib/apt/lists/*
32+
33+
RUN mkdir -p /etc/OpenCL/vendors && \
34+
echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd && \
35+
echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
36+
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf
37+
38+
ENV PATH=/usr/local/nvidia/bin:${PATH}
39+
ENV LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64:${LD_LIBRARY_PATH}
40+
41+
COPY --from=preprocess /htp/hashtopolis.zip ${APPDIR}/
42+
43+
COPY requirements.txt ${APPDIR}
44+
45+
RUN pip3 install -r requirements.txt
46+
47+
ENTRYPOINT ["python3", "hashtopolis.zip"]

config.json.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"debug": true,
3+
"voucher": "<voucher>",
4+
"url": "http://<server-ip>:<server-port>/api/server.php"
5+
}

docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
services:
2+
hashtopolis-agent:
3+
container_name: hashtopolis-agent
4+
image: hashtopolis/agent:latest
5+
volumes:
6+
- ./config.json:/htp/config.json
7+
deploy:
8+
resources:
9+
reservations:
10+
devices:
11+
- driver: nvidia
12+
count: all
13+
capabilities: [gpu]

0 commit comments

Comments
 (0)