Add docker compose support

This commit is contained in:
2025-11-24 07:41:10 +09:00
parent 93cc72d612
commit 9ff74550a2
4 changed files with 54 additions and 8 deletions
+15
View File
@@ -0,0 +1,15 @@
__pycache__/
*.py[cod]
*.swp
*.log
.env
.venv
venv
.git
.gitignore
.vscode
**/.DS_Store
*.sqlite3
*.db
.idea
node_modules
+19
View File
@@ -0,0 +1,19 @@
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY app ./app
EXPOSE 8080
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]
+6 -8
View File
@@ -18,16 +18,14 @@ PlexPlaylistSync 是一个用于同步 Plex 播放列表和本地 `.m3u`/`.m3u8`
默认情况下 Plex 服务器使用 `32400` 端口,可在未修改服务器端口时直接使用该默认值。 默认情况下 Plex 服务器使用 `32400` 端口,可在未修改服务器端口时直接使用该默认值。
登录页面提供选择 `http``https` 的下拉框,服务器地址输入框只需填写域名或 IP,默认值会从 `config.json` 读取。 登录页面提供选择 `http``https` 的下拉框,服务器地址输入框只需填写域名或 IP,默认值会从 `config.json` 读取。
## 安装 ## 开发环境快速启动(Docker Compose
首先安装依赖 项目已内置 Docker 化配置,开发时只需执行一次构建即可运行
```bash ```bash
pip install -r requirements.txt docker compose up --build
``` ```
然后启动服务: - 默认会以 `--reload` 模式启动,监听本地 8080 端口,可在浏览器访问 `http://localhost:8080`
- 通过 `./app/config.json` 保存的 Plex 配置信息会在主机和容器间共享,便于调试时保留登录 token 等数据。
```bash - 如需自定义端口或其他参数,可在 `docker-compose.yml` 中调整。
uvicorn app.main:app --port 8080
```
+14
View File
@@ -0,0 +1,14 @@
version: "3.9"
services:
plex-playlist-sync:
build: .
command: uvicorn app.main:app --host 0.0.0.0 --port 8080 --reload
ports:
- "8080:8080"
volumes:
- ./:/app
environment:
- PYTHONUNBUFFERED=1
- PYTHONDONTWRITEBYTECODE=1
restart: unless-stopped