mirror of
https://github.com/TheSmallHanCat/flow2api.git
synced 2026-05-07 06:19:24 +08:00
33 lines
885 B
Docker
33 lines
885 B
Docker
FROM python:3.11-slim
|
||
|
||
WORKDIR /app
|
||
|
||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||
PYTHONUNBUFFERED=1 \
|
||
ALLOW_DOCKER_HEADED_CAPTCHA=true \
|
||
DISPLAY=:99 \
|
||
PERSONAL_BROWSER_HEADLESS=0 \
|
||
PLAYWRIGHT_BROWSERS_PATH=0
|
||
|
||
RUN apt-get update \
|
||
&& apt-get install -y --no-install-recommends \
|
||
fluxbox \
|
||
x11-utils \
|
||
xauth \
|
||
xvfb \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
# 在镜像构建阶段预装 Playwright Chromium,供 personal/browser 模式复用
|
||
COPY requirements.txt ./
|
||
|
||
RUN pip install --no-cache-dir --root-user-action=ignore -r requirements.txt \
|
||
&& python -m playwright install --with-deps chromium
|
||
|
||
COPY . .
|
||
COPY docker/entrypoint.headed.sh /usr/local/bin/entrypoint.headed.sh
|
||
RUN sed -i 's/\r$//' /usr/local/bin/entrypoint.headed.sh && chmod +x /usr/local/bin/entrypoint.headed.sh
|
||
|
||
EXPOSE 8000
|
||
|
||
CMD ["/usr/local/bin/entrypoint.headed.sh"]
|