Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add docker support #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
nimenv_localminers/
my_model/
.DS_Store
.env
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ADDR=
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
nimenv_localminers/
my_model/
.DS_Store
.DS_Store
.env
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@
# nimble-miner-public
# nimble-miner-public

## How to use nimble miner with docker

### 1. Install docker and nvidia-docker
[install-guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)
#### Installing with Apt
1. Configure the production repository:
```
$ curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
```

2. Optionally, configure the repository to use experimental packages:

```
$ sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list
```

3. Update the packages list from the repository:

```
$ sudo apt-get update
```

4. Install the NVIDIA Container Toolkit packages:
```
$ sudo apt-get install -y nvidia-container-toolkit
```
### 2. Config ENV
copy .env.example to .env and edit it
```
cp .env.example .env
```

env example
```
ADDR=nimblexxxx
```
### 3. Start
#### via docker-compose
```
docker-compose up -d
<!-- See Log -->
docker logs -f nimble-miner-public-miner-1
```
#### via docker
```
docker build -t nimble-miner-public:latest .
docker run -d --gpus all --name nimble-miner-public-miner-1 nimble-miner-public:latest "python3 -u /app/execute.py ${YOUR_ADDR}"
21 changes: 21 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: "3.8"
services:
miner:
build: .
volumes:
- ./my_module:/app/my_module
- ./nimenv_localminers:/app/nimenv_localminers
command: "python3 -u /app/execute.py ${ADDR}"
env_file:
- .env
ulimits:
memlock: -1
stack: 67108864
# https://docs.docker.com/compose/gpu-support/
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1 # number of GPUs
capabilities: [gpu]
5 changes: 5 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM nvcr.io/nvidia/pytorch:23.07-py3
WORKDIR /app
COPY requirements-docker.txt /app
RUN pip install -r requirements-docker.txt
COPY . /app
6 changes: 6 additions & 0 deletions requirements-docker.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
requests==2.31.0
accelerate==0.27.0
transformers==4.38.1
datasets==2.17.1
numpy==1.26.4
gitpython==3.1.42