-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
39 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,29 @@ | ||
FROM python:3.12-alpine | ||
|
||
|
||
# Install dependencies | ||
RUN apk add --no-cache \ | ||
chromium \ | ||
xvfb \ | ||
x11vnc \ | ||
fluxbox \ | ||
nss \ | ||
freetype \ | ||
freetype-dev \ | ||
harfbuzz \ | ||
ca-certificates \ | ||
ttf-freefont | ||
ttf-freefont \ | ||
chromium \ | ||
chromium-chromedriver | ||
|
||
# Install x11vnc | ||
RUN mkdir ~/.vnc | ||
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd | ||
|
||
WORKDIR /usr/app/src | ||
COPY index.py requirements.txt ./ | ||
|
||
RUN pip install -r requirements.txt | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
COPY docker/scripts/startup.sh ./ | ||
|
||
# Run | ||
CMD [ "python", "./index.py"] | ||
CMD [ "./startup.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/sh | ||
|
||
echo "internally launching GUI (X11 environment)" | ||
|
||
rm -f /tmp/.X0-lock | ||
|
||
# Run Xvfb on display 0. | ||
Xvfb :0 -screen 0 1280x720x16 &>/dev/null & | ||
|
||
# Run fluxbox windows manager on display 0. | ||
fluxbox -display :0 &>/dev/null & | ||
|
||
# Run x11vnc on display 0 | ||
x11vnc -display :0 -forever -usepw &>/dev/null & | ||
|
||
# Add delay | ||
sleep 5 | ||
|
||
echo "launching the python script" | ||
|
||
# Run python script on display 0 | ||
DISPLAY=:0 python index.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters