-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from pur1fying/docker_support
Docker support
- Loading branch information
Showing
7 changed files
with
214 additions
and
2 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
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
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
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,13 @@ | ||
version: '3' | ||
services: | ||
baas_main: | ||
image: baas:v1.0 | ||
tty: true | ||
ports: | ||
# You can change the first port number to any other port number. | ||
# This is for VNC Viewer to access. | ||
- "5900:5900" | ||
restart: always | ||
container_name: blue_archive_auto_script | ||
volumes: | ||
- ./:/app |
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,37 @@ | ||
# Use the official Debian image as the base | ||
FROM hub.atomgit.com/amd64/debian:latest | ||
|
||
# Remove the original mirror | ||
RUN rm -rf /etc/apt/sources.list.d && apt-get clean && apt-get update --fix-missing | ||
|
||
# Alter the source to tsinghua mirror | ||
RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware\ndeb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware\ndeb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware\ndeb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware" > /etc/apt/sources.list | ||
|
||
# Install Git Env | ||
RUN apt-get update && apt-get install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget libglib2.0-dev git | ||
|
||
# Install GL Runtime | ||
RUN apt-get install -y libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-shape0 libxcb-xinerama0 libxcb-xkb1 libsm6 libxkbcommon-x11-0 libdbus-1-3 | ||
|
||
# Hard to Install due to the network. if you can't pass, please comment it. | ||
# RUN apt-get install -y libqt5pdf5 libtiff5-dev --fix-missing | ||
|
||
# Install Python Environment | ||
RUN wget https://mirrors.aliyun.com/python-release/source/Python-3.9.18.tar.xz | ||
RUN tar -xvJf Python-3.9.18.tar.xz | ||
RUN cd Python-3.9.18 && ./configure --enable-optimizations | ||
RUN cd Python-3.9.18 && make -j $(nproc) && make altinstall | ||
RUN rm -rf Python-3.9.18.tar.xz Python-3.9.18 | ||
|
||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# Copy the requirements file to the container | ||
COPY requirements.txt . | ||
|
||
# Copy the rest of the application code to the container | ||
COPY . . | ||
|
||
# Set the command to run the application | ||
CMD ["bash", "entrypoint.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,120 @@ | ||
#!/bin/bash | ||
|
||
# For Debug | ||
# export QT_DEBUG_PLUGINS=1 | ||
|
||
# Check the version | ||
GIT_HOME="/usr/bin/git" # 修改为你的 git 可执行文件路径 | ||
REPO_URL_HTTP="https://gitee.com/pur1fy/blue_archive_auto_script.git" # 修改为你的仓库地址 | ||
|
||
# 设置虚拟环境的名称 | ||
VENV_NAME="env" | ||
|
||
# 检查虚拟环境是否已经存在 | ||
if [ -d "$VENV_NAME" ]; then | ||
echo "[INFO] Virtual environment '$VENV_NAME' already exists." | ||
else | ||
# 创建虚拟环境 | ||
echo "[INFO] Creating virtual environment '$VENV_NAME'..." | ||
python3.9 -m venv "$VENV_NAME" | ||
|
||
# 检查虚拟环境是否成功创建 | ||
if [ ! -d "$VENV_NAME" ]; then | ||
echo "[ERROR] Failed to create the virtual environment." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# 激活虚拟环境 | ||
echo "[INFO] Activating virtual environment '$VENV_NAME'..." | ||
source "$VENV_NAME/bin/activate" | ||
|
||
# 确认虚拟环境已激活 | ||
if [ "$VIRTUAL_ENV" != "" ]; then | ||
echo "[INFO] Virtual environment '$VENV_NAME' activated successfully." | ||
else | ||
echo "[ERROR] Failed to activate the virtual environment." | ||
exit 1 | ||
fi | ||
|
||
|
||
echo "+--------------------------------+" | ||
echo "| UPDATE BAAS |" | ||
echo "+--------------------------------+" | ||
|
||
remote_sha=$($GIT_HOME ls-remote --heads origin refs/heads/master | awk '{print $1}') | ||
local_sha=$($GIT_HOME rev-parse HEAD) | ||
|
||
echo "[INFO] Remote SHA: $remote_sha" | ||
echo "[INFO] Local SHA: $local_sha" | ||
|
||
if [ "$local_sha" = "$remote_sha" ] && [ -z "$($GIT_HOME diff)" ]; then | ||
echo "[INFO] No updates available" | ||
else | ||
echo "[INFO] Pulling updates from the remote repository..." | ||
$GIT_HOME reset --hard HEAD | ||
$GIT_HOME pull "$REPO_URL_HTTP" | ||
|
||
updated_local_sha=$($GIT_HOME rev-parse HEAD) | ||
|
||
echo "[INFO] Updated SHA: $updated_local_sha" | ||
if [ "$updated_local_sha" = "$remote_sha" ]; then | ||
echo "[INFO] Update success" | ||
else | ||
echo "[ERROR] Failed to update the source code, please check your network or for conflicting files" | ||
fi | ||
fi | ||
|
||
ATX_APK_URL="https://gitee.com/pur1fy/blue_archive_auto_script_assets/raw/master/ATX.apk" | ||
|
||
APK_PATH="/app/src/atx_app/ATX.apk" | ||
|
||
echo "[INFO] Checking atx-agent..." | ||
|
||
# Check if ATX.apk exists | ||
if [ ! -f "$APK_PATH" ]; then | ||
echo "[INFO] Downloading atx-agent..." | ||
# Download ATX.apk | ||
wget -O "$APK_PATH" "$ATX_APK_URL" | ||
else | ||
echo "[INFO] Atx-agent already downloaded" | ||
fi | ||
|
||
|
||
# Install the env | ||
echo "[INFO] Check and Update the runtime environment..." | ||
pip3.9 install -r requirements-linux.txt -i https://pypi.tuna.tsinghua.edu.cn/simple | ||
|
||
# Start the app | ||
echo "[INFO] Starting the app..." | ||
|
||
# If you have display, it's ok to comment the first block | ||
# and uncomment the second block. | ||
|
||
######################################################### | ||
apt-get install -y xvfb x11vnc procps | ||
xvfb-run python3.9 window.py & | ||
|
||
# Wait until the xvfb is started | ||
sleep 5 | ||
|
||
xvfb_info=$(ps -aux | grep '[X]vfb') | ||
# Get Xvfb Info From proc | ||
|
||
|
||
# Abstract ":99" and "-auth xxxxx" | ||
display=$(echo "$xvfb_info" | grep -o ' :[0-9][0-9]') | ||
auth=$(echo "$xvfb_info" | grep -oP '(?<=-auth )[^ ]+') | ||
|
||
# Check the abstract status | ||
if [ -n "$display" ] && [ -n "$auth" ]; then | ||
# build and run x11vnc command | ||
x11vnc_cmd="x11vnc -display $display -auth $auth" | ||
echo "Running command: $x11vnc_cmd" | ||
$x11vnc_cmd | ||
else | ||
echo "Failed to extract display or auth information." | ||
fi | ||
######################################################### | ||
# xvfb-run python3.9 window.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
lmdb | ||
PyQt5 | ||
numpy | ||
flask | ||
cnocr | ||
imgaug | ||
onnxruntime | ||
adbutils <= 2.2.1 | ||
uiautomator2 | ||
opencv-python-headless | ||
PyQt-Fluent-Widgets | ||
|
||
paddlepaddle |