forked from ThePhaseless/Byparr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
66 lines (55 loc) · 1.32 KB
/
Dockerfile
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
59
60
61
62
63
64
65
66
FROM python:3.12-alpine
# Update and install dependencies
RUN apk update && apk upgrade && \
apk add --no-cache --virtual .build-deps \
alpine-sdk \
curl \
wget \
unzip \
gnupg && \
apk add --no-cache \
xvfb \
x11vnc \
fluxbox \
xterm \
libffi-dev \
openssl-dev \
zlib-dev \
bzip2-dev \
readline-dev \
git \
nss \
freetype \
freetype-dev \
harfbuzz \
ca-certificates \
ttf-freefont \
chromium \
chromium-chromedriver \
py3-pip
# Install Poetry through pip
RUN pip install --no-cache-dir poetry
WORKDIR /app
EXPOSE 8191
# Environment variables
ENV \
DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=true \
DISPLAY=:0
# Install Python dependencies using Poetry
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-root
# Copy and execute additional scripts
COPY fix_nodriver.py ./
RUN . /app/.venv/bin/activate && python fix_nodriver.py
COPY . .
# Ensure scripts are executable
RUN chmod +x ./run_vnc.sh ./entrypoint.sh
# Run tests and setup VNC environment
RUN ./run_vnc.sh && . /app/.venv/bin/activate && poetry run pytest
CMD ["./entrypoint.sh"]
# Clean up build dependencies to reduce image size
RUN apk del .build-deps