Skip to content
This repository has been archived by the owner on May 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #13 from nicett/master
Browse files Browse the repository at this point in the history
Docker镜像构建
  • Loading branch information
perrornet authored Jan 12, 2022
2 parents 87a6e96 + 7575a8b commit 93e84e1
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM golang:1.17.6-alpine3.15

ADD . /home/miner-proxy

RUN cd /home/miner-proxy && go mod tidy && cd ./cmd/miner-proxy && go build .

RUN mv /home/miner-proxy/docker-entrypoint /usr/bin/ && \
mv /home/miner-proxy/cmd/miner-proxy/miner-proxy /usr/bin/ && \
rm -rf /home/miner-proxy

WORKDIR /home

EXPOSE 9999

ENTRYPOINT ["docker-entrypoint"]

CMD ["miner-proxy","-h"]
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,57 @@ nbminer.exe -a ergo -o stratum+tcp://127.0.0.1:34568 -u perror.test -mt 3
2. ![](./images/hiveos-add-02.png)
3. ![](./images/hiveos-add-pool.png)
4. 点击"应用"后再点击更新即可


## 添加Docker启动方式
为方便快速部署,可移植性,采用Docker容器化方式部署

### 构建镜像
```
docker build -t miner-proxy:latest .
```

### 启动服务端容器
```
docker run \
-p 9999:9999 \
--restart=always \
--name miner-proxy \
-d miner-proxy:latest \
miner-proxy -l :9999 -r 矿池地址:矿池端口号 -secret_key 12345 -sc
```

### 启动客户端容器
```
docker run \
-p 9999:9999 \
--restart=always \
--name miner-proxy \
-d miner-proxy:latest \
miner-proxy -l :9999 -r 服务端ip:服务端端口 -secret_key 12345 -sc -client
```

### 启动客户端容器
```
docker run \
-p 9999:9999 \
--restart=always \
--name miner-proxy \
-d miner-proxy:latest \
miner-proxy -l :9999 -r 服务端ip:服务端端口 -secret_key 12345 -sc -client
```

### 查看容器日志
```
docker logs -f -t --tail=100 miner-proxy # -f 实时查看 -t带时间戳的 --tail=100最新100行日志
```

### 查看容器状态
```
docker stats miner-proxy
```

### 查看容器内进程状态
```
docker top miner-proxy
```
9 changes: 9 additions & 0 deletions docker-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
set -e

# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- miner-proxy "$@"
fi

exec "$@"

0 comments on commit 93e84e1

Please sign in to comment.