Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c6b0b0444 | |||
| b1c9fa5f8e |
+6
-1
@@ -6,9 +6,12 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends build-essential \
|
&& apt-get install -y --no-install-recommends build-essential tzdata \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||||
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||||
|
|
||||||
COPY requirements.txt ./
|
COPY requirements.txt ./
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
@@ -17,4 +20,6 @@ COPY frontend ./frontend
|
|||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||||
|
|
||||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]
|
||||||
|
|||||||
@@ -26,6 +26,22 @@ PlexPlaylistSync 是一个用于同步 Plex 播放列表和本地 `.m3u`/`.m3u8`
|
|||||||
docker compose up --build
|
docker compose up --build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 配置容器时区
|
||||||
|
|
||||||
|
本项目支持通过 `docker-compose.yml` 的环境变量 `TZ` 配置容器运行时区(需要使用有效的 IANA 时区名,例如 `Asia/Shanghai`、`UTC`、`America/New_York`)。
|
||||||
|
|
||||||
|
- 临时指定(当前终端会话生效):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
TZ=UTC docker compose up --build
|
||||||
|
```
|
||||||
|
|
||||||
|
- 或在项目根目录创建 `.env`:
|
||||||
|
|
||||||
|
```env
|
||||||
|
TZ=Asia/Shanghai
|
||||||
|
```
|
||||||
|
|
||||||
- 默认会以 `--reload` 模式启动,监听本地 8080 端口,可在浏览器访问 `http://localhost:8080`。
|
- 默认会以 `--reload` 模式启动,监听本地 8080 端口,可在浏览器访问 `http://localhost:8080`。
|
||||||
- 通过 `./app/config.json` 保存的 Plex 配置信息会在主机和容器间共享,便于调试时保留登录 token 等数据。
|
- 通过 `./app/config.json` 保存的 Plex 配置信息会在主机和容器间共享,便于调试时保留登录 token 等数据。
|
||||||
- 如需自定义端口或其他参数,可在 `docker-compose.yml` 中调整。
|
- 如需自定义端口或其他参数,可在 `docker-compose.yml` 中调整。
|
||||||
|
|||||||
@@ -11,4 +11,5 @@ services:
|
|||||||
- PYTHONUNBUFFERED=1
|
- PYTHONUNBUFFERED=1
|
||||||
- PYTHONDONTWRITEBYTECODE=1
|
- PYTHONDONTWRITEBYTECODE=1
|
||||||
- LOG_LEVEL=INFO
|
- LOG_LEVEL=INFO
|
||||||
|
- TZ=${TZ:-Asia/Tokyo}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Configure timezone inside the container if TZ is provided.
|
||||||
|
# This avoids relying on host mounts like /etc/localtime, which are awkward on Windows.
|
||||||
|
if [ "${TZ:-}" != "" ]; then
|
||||||
|
ZONEINFO="/usr/share/zoneinfo/${TZ}"
|
||||||
|
if [ -e "$ZONEINFO" ]; then
|
||||||
|
ln -snf "$ZONEINFO" /etc/localtime
|
||||||
|
echo "$TZ" > /etc/timezone
|
||||||
|
else
|
||||||
|
echo "[entrypoint] Warning: TZ='$TZ' not found at $ZONEINFO; keeping existing timezone." >&2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
Reference in New Issue
Block a user