forked from TheSmallHanCat/flow2api
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.headed
More file actions
58 lines (46 loc) · 1.52 KB
/
Copy pathDockerfile.headed
File metadata and controls
58 lines (46 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Build frontend
FROM node:20-slim AS frontend-builder
WORKDIR /app/frontend
ARG VITE_NOVNC_URL=
ENV VITE_NOVNC_URL=${VITE_NOVNC_URL}
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ ./
RUN npm run build
# Build backend (headed)
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 \
ca-certificates \
curl \
fluxbox \
novnc \
tini \
websockify \
x11-utils \
x11vnc \
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 built frontend assets from builder stage
COPY --from=frontend-builder /app/frontend/dist /app/static
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
COPY docker/fluxbox/fluxbox-chromium /usr/local/bin/fluxbox-chromium
RUN chmod +x /usr/local/bin/fluxbox-chromium
COPY docker/fluxbox/menu /root/.fluxbox/menu
EXPOSE 8000 5900 6080
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["/usr/local/bin/entrypoint.headed.sh"]