-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Qetesh/Publishing-Docker-images
Publishing docker images
- Loading branch information
Showing
4 changed files
with
103 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: CDN_bestIP docker image | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
# list of Docker images to use as base name for tags | ||
images: | | ||
ghcr.io/${{ github.repository }} | ||
# generate Docker tags based on the following events/attributes | ||
tags: | | ||
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }} | ||
type=pep440,pattern={{raw}},enable=${{ startsWith(github.ref, 'refs/tags/') }} | ||
- name: Build and push Docker image | ||
id: push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# CDN_bestIP | ||
[](https://github.com/Qetesh/CDN_bestIP/actions/workflows/docker-image.yml) | ||
|
||
[中文版本](README.md) | [English Version](README_EN.md) | ||
|
||
|
@@ -33,7 +34,34 @@ CDN_bestIP 是一个使用 Python 编写的项目,通过[官方链接](https:/ | |
> docker安装 https://docs.docker.com/engine/install/ | ||
> | ||
> docker compose安装 https://docs.docker.com/compose/install/ | ||
``` | ||
docker run -d --name ghcr.io/qetesh/cdn_bestip:latest \ | ||
--restart always \ | ||
-e domain='example.com' \ | ||
-e record_name='cdn' \ | ||
-e api_key='ccccccccccccccccccccccccccccccc' \ | ||
-e email='[email protected]' \ | ||
-e stUrl='https://xxxxxxx.cloudfront.net/100MB.test' \ | ||
cdn_bestip | ||
``` | ||
|
||
使用 Docker Compose 运行,可参考[docker-compose.yml](docker-compose.yml)。需先设置`.env`文件: | ||
.env | ||
```shell | ||
domain = 'example.com' | ||
record_name = 'cdn' | ||
api_key = 'ccccccccccccccccccccccccccccccc' | ||
email = '[email protected]' | ||
stUrl = 'https://xxxxxxx.cloudfront.net/100MB.test' | ||
``` | ||
|
||
```shell | ||
docker compose build | ||
docker compose up -d | ||
``` | ||
|
||
<details> | ||
<summary>Docker 本地构建运行</summary> | ||
该项目可以在 Docker 环境中运行。你可以使用提供的 Dockerfile 构建镜像,并通过 Docker 或 Docker Compose 运行。 | ||
|
||
首先,使用以下命令构建 Docker 镜像: | ||
|
@@ -70,8 +98,10 @@ stUrl = 'https://xxxxxxx.cloudfront.net/100MB.test' | |
docker compose build | ||
docker compose up -d | ||
``` | ||
--- | ||
</details> | ||
|
||
<details> | ||
<summary>使用方法-本地运行</summary> | ||
## 使用方法-本地运行 | ||
|
||
### 1. 克隆项目 | ||
|
@@ -81,7 +111,6 @@ docker compose up -d | |
```shell | ||
git clone https://github.com/qetesh/CDN_bestIP.git | ||
``` | ||
|
||
### 2. 安装依赖 | ||
|
||
安装python3、pip3: | ||
|
@@ -111,6 +140,7 @@ export domain='example.com' record_name='cdn' api_key='ccccccccccccccccccccccccc | |
```shell | ||
python3 main.py | ||
``` | ||
</details> | ||
|
||
--- | ||
|
||
|
@@ -120,8 +150,12 @@ python3 main.py | |
- https://www.maxmind.com | ||
|
||
## Todo | ||
- [ ] CDN - CloudFlare 测试添加 | ||
- [ ] DNS服务器接入 | ||
### CDN | ||
- [x] aws CloudFront | ||
- [ ] CloudFlare | ||
### DNS服务商 | ||
- [x] CloudFlare | ||
- [ ] DNSPod | ||
|
||
## 贡献 | ||
|
||
|
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,14 @@ | ||
version: '3.3' | ||
services: | ||
cdn_bestip: | ||
build: ./ | ||
container_name: cdn_bestip | ||
image: cdn_bestip | ||
restart: always | ||
environment: | ||
TZ: Asia/Shanghai | ||
domain: $domain | ||
record_name: $record_name | ||
api_key: $api_key | ||
email: $email | ||
stUrl: $stUrl |
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