Skip to content

Commit f64afbb

Browse files
committed
Add a Dockerfile with CUDA support.
- Multistage build, runtime still larger than it could be.
1 parent 1b86968 commit f64afbb

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,23 @@ Privkey: 5JcX7HgrPxEbYKcWhtBT83L3BHcdJ8K8p8X1sNHmcJLsSyMNycZ
128128
## How Split-key Works
129129
See the explanation in another similar [project](https://github.com/JeanLucPons/VanitySearch#how-it-works).
130130

131+
# CUDA Docker Image
132+
133+
## Build Image
134+
```shell
135+
$ docker build -f docker/Dockerfile.cuda -t vanitygen-plusplus:latest .
136+
```
137+
138+
## Running with [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/overview.html)
139+
```shell
140+
$ docker run -it --gpus all vanitygen-plusplus:latest 1Love
141+
Difficulty: 4476342
142+
Compiling kernel, can take minutes...done!
143+
Pattern: 1Love
144+
Address: 1LovebbyvEuCnJoKZBXDA6kqts6Q2KG1WJ
145+
Privkey: 5K3J3aA8XkvfdjhJcZ8BJhTUKAjYATCey9AdgahRvoxGB9gLUoD
146+
```
147+
131148
# Credit
132149
Many thanks to following projects:
133150
1. https://github.com/samr7/vanitygen

docker/Dockerfile.cuda

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM nvidia/cuda:11.7.0-devel-ubuntu20.04 as build
2+
3+
# bring in source
4+
WORKDIR /vanitygen-plusplus
5+
COPY . /vanitygen-plusplus
6+
7+
# Build Requirements
8+
#
9+
# NOTE(canardleteer): I didn't have any luck getting `make test` to work, so
10+
# have omitted `check`.
11+
ENV DEBIAN_FRONTEND=noninteractive
12+
RUN apt update && \
13+
apt install -y make gcc libssl-dev libpcre3-dev libcurl4-openssl-dev nvidia-opencl-dev && \
14+
rm -rf /var/lib/apt/lists/*
15+
16+
# NOTE(canardleteer): `make install` target wanted.
17+
RUN make all
18+
19+
# The runtime image is approximately half the size of the `build` image.
20+
FROM nvidia/cuda:11.7.0-runtime-ubuntu20.04
21+
22+
# NOTE(canardleteer): `libcurl4` is needed by oclvanityminer. I'd like to use
23+
# something smaller than `nvidia-opencl-dev` if anyone has
24+
# any suggestions.
25+
RUN apt update && apt install -y libcurl4 nvidia-opencl-dev && rm -rf /var/lib/apt/lists/*
26+
27+
COPY --from=build /vanitygen-plusplus/oclvanitygen++ /usr/bin
28+
COPY --from=build /vanitygen-plusplus/oclvanityminer /usr/bin
29+
COPY --from=build /vanitygen-plusplus/vanitygen++ /usr/bin
30+
COPY --from=build /vanitygen-plusplus/keyconv /usr/bin
31+
COPY --from=build /vanitygen-plusplus/calc_addrs.cl .
32+
33+
# The other binaries are available by setting `--entrypoint` upon a `docker run`.
34+
ENTRYPOINT ["/usr/bin/oclvanitygen++"]

0 commit comments

Comments
 (0)