Skip to content

Commit

Permalink
feat(docker): Support for Docker Deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
KimmyXYC committed Mar 3, 2024
1 parent 5aab805 commit 4f9d583
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/docker-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Docker Image CI

on:
push:
branches: [ main ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to ghcr.io
uses: docker/login-action@master
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@master
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@master
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM python:3.11-slim
WORKDIR /app
COPY . /app
RUN pip install --upgrade --no-cache-dir pip && pip install --no-cache-dir -r requirements.txt
CMD ["python", "main.py"]
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ dns - 查询域名 DNS 信息
```
## 安装 / Installation

- 安装依赖。Install dependencies.
- 克隆仓库。Clone the repository.
```shell
git clone https://github.com/KimmyXYC/PingBot.git
pip3 install -r requirements.txt
```

- 复制配置文件。Copy configuration file.
Expand All @@ -32,4 +31,18 @@ url = "socks5://127.0.0.1:7890"

[ip]
appcode = "1234567890" # Required, Aliyun AppCode
```

[icp]
server = "https://icp.example.com" # Required, ICP API Server
```

### 本地部署 / Local Deployment
- 安装依赖。Install dependencies.
```shell
pip install -r requirements.txt
```
### Docker 部署 / Docker Deployment
- 使用预构建镜像。Use pre-built image.
```shell
docker run -d --name pingbot -v $(pwd)/Config:/app/Config ghcr.io/kimmyxyc/pingbot:main
```

0 comments on commit 4f9d583

Please sign in to comment.