Skip to content

Commit

Permalink
Modify Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
nfe-w committed Nov 11, 2023
1 parent a5a998a commit e5f275c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
13 changes: 3 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@ WORKDIR /app

COPY . /app/

RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple \
&& chmod +x entrypoint.sh

# 在容器启动时检查配置文件的存在,并运行main.py
CMD ["sh", "-c", "\
if [ -f /mnt/config_bili.ini ]; then \
cp -f /mnt/config_bili.ini /app/config_bili.ini; \
python -u main.py; \
else \
echo 'Error: /mnt/config_bili.ini file not found. Please mount the /mnt/config_bili.ini file and try again.'; \
exit 1; \
fi"]
ENTRYPOINT ["./entrypoint.sh"]
9 changes: 9 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

if [ ! -f /mnt/config_bili.sh ]; then
echo 'Error: /mnt/config_bili.ini file not found. Please mount the /mnt/config_bili.ini file and try again.'
exit 1
fi

cp -f /mnt/config_bili.ini /app/config_bili.ini
python -u main.py

0 comments on commit e5f275c

Please sign in to comment.