Skip to content

Commit

Permalink
Update docker-compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
D6397 authored Nov 22, 2024
1 parent c2d6620 commit f53cae6
Showing 1 changed file with 39 additions and 25 deletions.
64 changes: 39 additions & 25 deletions .github/workflows/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
version: '3.8'

services:
edge-tts-web:
build:
context: .
dockerfile: Dockerfile
container_name: edge-tts-web
restart: unless-stopped
ports:
- "8005:8005"
volumes:
- ./static/audio:/app/static/audio
- ./tts.log:/app/tts.log
environment:
- TZ=Asia/Shanghai
# 可选环境变量
- LOG_LEVEL=INFO
- MAX_AUDIO_AGE=1800 # 音频文件保存时间(秒)
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8005/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# 使用官方 Python 基础镜像
FROM python:3.9-slim

# 设置工作目录
WORKDIR /app

# 设置环境变量
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
TZ=Asia/Shanghai

# 安装系统依赖
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
curl \
libmagic1 \
&& rm -rf /var/lib/apt/lists/* \
&& ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone

# 复制项目文件
COPY requirements.txt .

# 安装Python依赖
RUN pip install --no-cache-dir -r requirements.txt

# 复制应用程序代码
COPY . .

# 创建必要的目录
RUN mkdir -p static/audio \
&& chmod -R 755 static

# 暴露端口
EXPOSE 8005

# 启动命令
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8005"]

0 comments on commit f53cae6

Please sign in to comment.