chore: update port to 8456, configure Docker for NAS deployment
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Publish Docker image / main (push) Waiting to run
Translate README / build (push) Waiting to run

This commit is contained in:
vndangkhoa 2026-02-20 20:18:30 +07:00
parent 42784ffc83
commit 3467472fb7
4 changed files with 113 additions and 17 deletions

View file

@ -22,5 +22,8 @@ RUN pip install --no-cache-dir -r requirements.txt
# 确保启动脚本可执行
RUN chmod +x start.sh
# 暴露端口
EXPOSE 8456
# 设置容器启动命令
CMD ["./start.sh"]

View file

@ -25,7 +25,7 @@ Web:
API:
# Network Configuration
Host_IP: 0.0.0.0 # default IP | 默认IP
Host_Port: 80 # default port is 80 | 默认端口为80
Host_Port: 8456 # default port is 8456 | 默认端口为8456
Docs_URL: /docs # API documentation URL | API文档URL
Redoc_URL: /redoc # API documentation URL | API文档URL

68
deploy.ps1 Normal file
View file

@ -0,0 +1,68 @@
<#
.SYNOPSIS
Deploys the Douyin_TikTok_Download_API to a local Docker image or pushes to a remote registry.
.DESCRIPTION
This script builds the Docker image and optionally pushes it to a registry or saves it as a tar file for manual transfer.
.PARAMETER Push
If specified, pushes the image to the registry defined in $Registry.
.PARAMETER Save
If specified, saves the image to a .tar file for manual transfer.
.EXAMPLE
.\deploy.ps1 -Save
Builds the image and saves it to douyin_tiktok_download_api.tar
.EXAMPLE
.\deploy.ps1 -Push
Builds the image and pushes it to your private registry.
#>
param (
[Switch]$Push,
[Switch]$Save
)
$ImageName = "douyin_tiktok_download_api"
# Update this with your actual registry if you use one, e.g., git.khoavo.myds.me/vndangkhoa/douyin-api
$Registry = "git.khoavo.myds.me/vndangkhoa/douyin-api"
$Tag = "latest"
Write-Host "Building Docker image..." -ForegroundColor Cyan
docker-compose build
if ($LASTEXITCODE -ne 0) {
Write-Error "Build failed!"
exit 1
}
Write-Host "Build successful!" -ForegroundColor Green
if ($Save) {
Write-Host "Saving image to ${ImageName}.tar..." -ForegroundColor Cyan
docker save -o ${ImageName}.tar ${ImageName}:${Tag}
Write-Host "Image saved to ${PWD}\${ImageName}.tar" -ForegroundColor Green
Write-Host "You can now upload this file to your Synology NAS and load it via Docker."
}
if ($Push) {
$RemoteImage = "${Registry}:${Tag}"
Write-Host "Tagging image as ${RemoteImage}..." -ForegroundColor Cyan
docker tag ${ImageName}:${Tag} ${RemoteImage}
Write-Host "Pushing image to ${Registry}..." -ForegroundColor Cyan
docker push ${RemoteImage}
if ($LASTEXITCODE -ne 0) {
Write-Error "Push failed! Make sure you are logged in to the registry."
exit 1
}
Write-Host "Push successful!" -ForegroundColor Green
}
if (-not $Push -and -not $Save) {
Write-Host "Build complete. Use -Save to create a transferable file or -Push to push to a registry." -ForegroundColor Yellow
}

View file

@ -1,17 +1,42 @@
version: "3.9" # Docker Compose 文件版本
version: "3.9"
services: # 定义服务列表
douyin_tiktok_download_api: # 服务名称
image: evil0ctal/douyin_tiktok_download_api # 使用的 Docker 镜像
network_mode: host # 使用主机网络模式
container_name: douyin_tiktok_download_api # 容器名称
restart: always # 容器退出后总是重启
volumes: # 挂载卷配置
- ./douyin_tiktok_download_api/douyin_web/config.yaml:/app/crawlers/douyin/web/config.yaml
- ./douyin_tiktok_download_api/tiktok_web/config.yaml:/app/crawlers/tiktok/web/config.yaml
- ./douyin_tiktok_download_api/tiktok_app/config.yaml:/app/crawlers/tiktok/app/config.yaml
environment: # 环境变量配置
TZ: Asia/Shanghai # 设置时区为亚洲/上海
PUID: 1026 # 设置容器内部的用户 ID
PGID: 100 # 设置容器内部的用户组 ID
privileged: true # 设置特权模式以便容器内部可以执行特权操作
services:
douyin_tiktok_download_api:
# Build from the current directory
build:
context: .
dockerfile: Dockerfile
image: git.khoavo.myds.me/vndangkhoa/kv-tiktok-download:v1
container_name: douyin_tiktok_download_api
restart: always
# Use bridge mode with explicit port mapping for better NAS compatibility
ports:
- "${HOST_PORT:-8456}:8456"
volumes:
# Mount configuration file
- ./config.yaml:/app/config.yaml
# Mount download directory to persist data
- ./download:/app/download
# (Optional) Mount log directory if the app writes logs to a specific file
# - ./logs:/app/logs
environment:
- TZ=${TZ:-Asia/Shanghai}
- PUID=${PUID:-1026}
- PGID=${PGID:-100}
# You can add other environment variables here if the app supports them
# Set user/group to avoid permission issues if the container supports PUID/PGID internally
# Note: If the app doesn't natively support PUID/PGID,
# we might need to rely on the user running the container to set permissions on the volumes.
# However, LinuxServer.io style containers use these env vars.
# This specific app might not use them in its entrypoint, but it doesn't hurt to have them available.
# Resource limits (optional, good for NAS)
# deploy:
# resources:
# limits:
# cpus: '0.50'
# memory: 512M