forked from JeanLucPons/VanitySearch
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds docker support for the project. Docker builds include CPU-only version, as well as different tags for some NVIDIA compute capability versions. Deploy scripts are provided, image name and used versions of both CUDA SDK and CCAP are customizable via env. Added make argument: upper-cased `CAPP` which accepts version in dotted notation (e.g. "5.2"); lower-cased `capp` is derived from it, but should still be directly overridable as any other make's variable. Instructions in README are updated accordingly. Linux section got reformatted and reworked and overall became more comprehensible (IMHO). Adding CI and automatic builds are left as an exercise for curious readers.
- Loading branch information
Showing
9 changed files
with
262 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
# make sure we run from the root of the repository | ||
[ "$(basename "$PWD")" == "docker" ] && cd .. | ||
|
||
export IMAGE_NAME="${IMAGE_NAME:-vanitysearch}" | ||
|
||
env CCAP=6.0 CUDA=10.2 ./docker/cuda/build.sh | ||
docker tag "${IMAGE_NAME}":cuda-ccap-6.0 "${IMAGE_NAME}":latest | ||
docker tag "${IMAGE_NAME}":cuda-ccap-6.0 "${IMAGE_NAME}":cuda-ccap-6 | ||
|
||
env CCAP=5.2 CUDA=10.2 ./docker/cuda/build.sh | ||
docker tag "${IMAGE_NAME}":cuda-ccap-5.2 "${IMAGE_NAME}":cuda-ccap-5 | ||
|
||
env CCAP=2.0 CUDA=8.0 ./docker/cuda/build.sh | ||
docker tag "${IMAGE_NAME}":cuda-ccap-2.0 "${IMAGE_NAME}":cuda-ccap-2 | ||
|
||
./docker/cpu/build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Multistage docker build, requires docker 17.05 | ||
|
||
# builder stage | ||
FROM gcc:10.1 as builder | ||
|
||
COPY . /app | ||
|
||
RUN cd /app && make all | ||
|
||
# runtime stage | ||
FROM debian:buster-slim | ||
|
||
COPY --from=builder /app/VanitySearch /usr/bin/VanitySearch | ||
|
||
ENTRYPOINT ["/usr/bin/VanitySearch"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
# make sure we run from the root of the repository | ||
[ "$(basename "$PWD")" == "cpu" ] && cd ../.. | ||
[ "$(basename "$PWD")" == "docker" ] && cd .. | ||
|
||
IMAGE_NAME="${IMAGE_NAME:-vanitysearch}" | ||
|
||
docker build \ | ||
-t "${IMAGE_NAME}:cpu" \ | ||
-t "${IMAGE_NAME}:latest" \ | ||
-f ./docker/cpu/Dockerfile . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Multistage docker build, requires docker 17.05 | ||
|
||
# CUDA SDK version, and also a prefix of images' tag. | ||
# Check out the list of officially supported tags: | ||
# https://gitlab.com/nvidia/container-images/cuda/blob/master/doc/supported-tags.md | ||
# Format: x.y, e.g.: "10.2". | ||
# Required argument. | ||
ARG CUDA | ||
|
||
# builder stage | ||
FROM nvidia/cuda:${CUDA}-devel as builder | ||
|
||
COPY . /app | ||
|
||
# CUDA Computational Capability. | ||
# Format: x.y, e.g.: "5.2". | ||
# Required argument. | ||
ARG CCAP | ||
|
||
RUN cd /app && \ | ||
make \ | ||
CUDA=/usr/local/cuda \ | ||
CXXCUDA=/usr/bin/g++ \ | ||
gpu=1 \ | ||
"CCAP=${CCAP}" \ | ||
all | ||
|
||
# runtime stage | ||
FROM nvidia/cuda:${CUDA}-runtime | ||
|
||
COPY --from=builder /app/VanitySearch /usr/bin/VanitySearch | ||
|
||
ENTRYPOINT ["/usr/bin/VanitySearch"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
|
||
# make sure we run from the root of the repository | ||
[ "$(basename "$PWD")" == "cuda" ] && cd ../.. | ||
[ "$(basename "$PWD")" == "docker" ] && cd .. | ||
|
||
IMAGE_NAME="${IMAGE_NAME:-vanitysearch}" | ||
# default arguments | ||
CCAP="${CCAP:-5.2}" | ||
CUDA="${CUDA:-10.2}" | ||
|
||
CAPP_MAJOR="${CCAP%.*}" | ||
|
||
if [ "${CAPP_MAJOR}" -lt 5 ]; then | ||
# For 2.x and 3.x branches | ||
DOCKERFILE=./docker/cuda/ccap-2.0.Dockerfile | ||
else | ||
DOCKERFILE=./docker/cuda/Dockerfile | ||
fi | ||
|
||
docker build \ | ||
--build-arg "CCAP=${CCAP}" \ | ||
--build-arg "CUDA=${CUDA}" \ | ||
-t "${IMAGE_NAME}:cuda-ccap-${CCAP}" \ | ||
-f "${DOCKERFILE}" . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Multistage docker build, requires docker 17.05 | ||
|
||
# CUDA SDK version, and also a prefix of images' tag. | ||
# Check out the list of officially supported tags: | ||
# https://gitlab.com/nvidia/container-images/cuda/blob/master/doc/supported-tags.md | ||
# Format: x.y, e.g.: "10.2". | ||
# Required argument. | ||
ARG CUDA | ||
|
||
# builder stage | ||
FROM nvidia/cuda:${CUDA}-devel as builder | ||
|
||
# Install newer version of g++ than what Ubuntu 16.04 provides. | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
software-properties-common \ | ||
&& \ | ||
add-apt-repository ppa:ubuntu-toolchain-r/test && \ | ||
apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
g++-7 \ | ||
&& \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY . /app | ||
|
||
# CUDA Computational Capability. | ||
# Format: x.y, e.g.: "5.2". | ||
# Required argument. | ||
ARG CCAP | ||
|
||
RUN cd /app && \ | ||
make \ | ||
CXX=/usr/bin/g++-7 \ | ||
CUDA=/usr/local/cuda \ | ||
CXXCUDA=/usr/bin/g++ \ | ||
gpu=1 \ | ||
"CCAP=${CCAP}" \ | ||
all | ||
|
||
# runtime stage | ||
FROM nvidia/cuda:${CUDA}-runtime | ||
|
||
COPY --from=builder /app/VanitySearch /usr/bin/VanitySearch | ||
|
||
ENTRYPOINT ["/usr/bin/VanitySearch"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
export IMAGE_NAME="${IMAGE_NAME:-vanitysearch}" | ||
|
||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||
|
||
docker push "${IMAGE_NAME}":latest | ||
docker push "${IMAGE_NAME}":cuda-ccap-6 | ||
docker push "${IMAGE_NAME}":cuda-ccap-6.0 | ||
|
||
docker push "${IMAGE_NAME}":cuda-ccap-5 | ||
docker push "${IMAGE_NAME}":cuda-ccap-5.2 | ||
|
||
docker push "${IMAGE_NAME}":cuda-ccap-2 | ||
docker push "${IMAGE_NAME}":cuda-ccap-2.0 | ||
|
||
docker push "${IMAGE_NAME}":cpu |