-
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.
- Loading branch information
Showing
3 changed files
with
136 additions
and
0 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,59 @@ | ||
name: dockerbuild | ||
# https://github.com/marketplace/actions/build-and-push-docker-images#path-context | ||
# https://docs.docker.com/build/ci/github-actions/ | ||
# https://blog.isayme.org/posts/issues-55/ | ||
|
||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
workflow_dispatch: | ||
repository_dispatch: | ||
types: [webhook] | ||
|
||
env: | ||
APP_NAME: tg_setu_bot | ||
DOCKERHUB_REPO: sikii/tg_setu_bot | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
# 构建 Docker 并推送到 Docker hub | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
# 是否 docker push | ||
push: true | ||
# 生成多平台镜像, see https://github.com/docker-library/bashbrew/blob/v0.1.1/architecture/oci-platform.go | ||
# platforms: | | ||
# linux/amd64 | ||
platforms: | | ||
linux/amd64 | ||
linux/arm/v6 | ||
linux/arm/v7 | ||
linux/arm64/v8 | ||
# docker build arg, 注入 APP_NAME/APP_VERSION | ||
build-args: | | ||
APP_NAME=${{ env.APP_NAME }} | ||
APP_VERSION=${{ env.APP_VERSION }} | ||
# 生成两个 docker tag: ${APP_VERSION} 和 latest | ||
tags: | | ||
${{ env.DOCKERHUB_REPO }}:latest |
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 @@ | ||
FROM node:18-alpine | ||
|
||
LABEL maintainer="IITII <ccmejx@gmail.com>" | ||
|
||
ADD . /app | ||
#RUN mkdir | ||
WORKDIR /app | ||
VOLUME ["/app/db", "/app/tmp", "/app/logs"] | ||
|
||
RUN npm i | ||
|
||
CMD ["npm", "start"] |
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,65 @@ | ||
version: "3" | ||
services: | ||
web: | ||
image: sikii/tg_setu_bot:latest | ||
restart: unless-stopped | ||
network_mode: bridge | ||
hostname: tg_setu_bot | ||
container_name: tg_setu_bot | ||
logging: | ||
driver: json-file | ||
options: | ||
max-size: 1m | ||
depends_on: | ||
- redis | ||
environment: | ||
- TG_DEBUG=false | ||
- TZ=Asia/Shanghai | ||
# tg 机器人 token | ||
- BOT_TOKEN=xxxxxxxx | ||
# 订阅专用 token, 必填, 且加入到 forward channel 中 | ||
- SUBSCRIBE_TOKEN= | ||
# 图片专用 token, 支持多个token, 用逗号分隔 | ||
- WORKERS_TOKEN= | ||
# 管理员 ID | ||
- ADMIN_ID= | ||
# 配置后下载时自动转发消息到指定channel | ||
- FORWARD_ID= | ||
# 是否将搜索结果发送到订阅频道, 默认 false | ||
- SEND_TO_SUB=false | ||
# REDIS_URL | ||
- REDIS_URL=redis://:review_pic@redis:6379 | ||
# 同订阅检查间隔 hour, 默认 6h | ||
# - CHECK_ALL=6 | ||
# 检查间隔的随机范围, 默认 0.2 即 0.8 ~ 1.2 倍 | ||
# - CHECK_RANDOM_RATE=0.2 | ||
# redis 扫描周期 min, 默认 5min | ||
# - CHECK_PERIOD=5 | ||
# tg 机器人代理 | ||
# - PROXY= | ||
# 用户状态缓存文件 | ||
# - DB_FILE= | ||
# acgBox cookie | ||
# - ACG_BOX_COOKIE= | ||
# acgBox password | ||
# - ACG_BOX_PASSWORD= | ||
volumes: | ||
- ./runs/db:/app/db | ||
- ./runs/tmp:/app/tmp | ||
- ./runs/logs:/app/logs | ||
redis: | ||
image: redis:alpine | ||
restart: unless-stopped | ||
network_mode: bridge | ||
hostname: redis | ||
container_name: redis | ||
logging: | ||
driver: json-file | ||
options: | ||
max-size: 1m | ||
command: ["redis-server", "--requirepass review_pic"] | ||
# 映射Redis默认端口 | ||
# ports: | ||
# - "6379:6379" | ||
volumes: | ||
- ./runs/redis_data:/data |