-
Notifications
You must be signed in to change notification settings - Fork 7
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
62 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
env: | ||
IMAGE_NAME: nfew/bili_dynamic_push | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3.0.0 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Build and Push Docker Image | ||
run: | | ||
docker build -t ${{ env.IMAGE_NAME }}:latest . | ||
docker push ${{ env.IMAGE_NAME }}:latest |
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,20 @@ | ||
FROM python:3.9-slim | ||
|
||
# 设置容器的时区为中国北京时间 | ||
ENV TZ=Asia/Shanghai | ||
|
||
WORKDIR /app | ||
|
||
COPY . /app/ | ||
|
||
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple | ||
|
||
# 在容器启动时检查配置文件的存在,并运行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"] |
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