Skip to content

Commit

Permalink
pub to docker
Browse files Browse the repository at this point in the history
  • Loading branch information
littleneko committed Dec 31, 2022
1 parent fc126d1 commit 5263ce1
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 4 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/dockerhub-description.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Update Docker Hub Description
on:
push:
branches:
- main
paths:
- README.md
- .github/workflows/dockerhub-description.yml

jobs:
dockerHubDescription:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: littleneko/bing-dl
short-description: ${{ github.event.repository.description }}
44 changes: 44 additions & 0 deletions .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: docker

on:
workflow_dispatch:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: littleneko/bing-dl
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# syntax=docker/dockerfile:1

FROM python:latest
FROM python:3.10-slim

WORKDIR /bing

COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
COPY . .
COPY src/ .

CMD [ "python3", "bing.py"]
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
# bing_wallpaper
a scripy to download bing daliy wallpaper

## Docker Usage

```shell
docker run \
-v /path/to/your/config:/bing/config \
-v /path/to/your/database:/bing/database \
-v /path/to/your/wallpaper:/bing/wallpaper \
bing-dl:latest
```
2 changes: 1 addition & 1 deletion config/bing.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[base]
database_dir = database
download_dir = bing
download_dir = wallpaper
file_log = false
log_dir = log
scan_sec = 3600
Expand Down
5 changes: 4 additions & 1 deletion bing.py → src/bing.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ def run(sqlite: str):
logging.info("[Bing] image exist: date=%s, hsh=%s, url=%s", date, hsh, url)
conn.close()
logging.info("[Bing] wait for next round after %s second", conf.scan_sec)
time.sleep(conf.scan_sec)
try:
time.sleep(conf.scan_sec)
except KeyboardInterrupt:
break


def download_img(zone: str, date: str, url: str) -> bool:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 5263ce1

Please sign in to comment.