mirror of
https://github.com/serega404/VodokanalBot.git
synced 2025-04-21 22:40:46 +03:00
Compare commits
No commits in common. "80af7ec775659baafd53a727b8575239562185f0" and "2a968f35285f8aa6ad367d1d061f86f4a8e62215" have entirely different histories.
80af7ec775
...
2a968f3528
41
.github/workflows/github-push-docker.yml
vendored
41
.github/workflows/github-push-docker.yml
vendored
@ -1,41 +0,0 @@
|
||||
name: Create and publish a Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push-image:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
17
Dockerfile
17
Dockerfile
@ -1,17 +0,0 @@
|
||||
FROM python:3.11.2-alpine3.17
|
||||
|
||||
LABEL Maintainer="serega404"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt requirements.txt
|
||||
RUN pip3 install -r requirements.txt
|
||||
|
||||
# Setting up crontab
|
||||
COPY crontab /tmp/crontab
|
||||
RUN cat /tmp/crontab > /etc/crontabs/root
|
||||
|
||||
COPY main.py main.py
|
||||
|
||||
# run crond as main process of container
|
||||
CMD ["crond", "-f", "-l", "2"]
|
26
README.md
26
README.md
@ -1,25 +1 @@
|
||||
# VodokanalParser
|
||||
|
||||
[](https://github.com/serega404/VodokanalBot)
|
||||
|
||||
### Запуск в Docker
|
||||
|
||||
``` Docker
|
||||
docker volume create vodokanal_bot_data
|
||||
docker run -d --name VodokanalBot \
|
||||
--restart=always \
|
||||
-v vodokanal_bot_data:/app/data \
|
||||
-e TZ='Europe/Moscow' \
|
||||
-e TELEGRAM_TOKEN='TOKEN' \
|
||||
-e TELEGRAM_CHANNEL='CHAT_ID' \
|
||||
ghcr.io/serega404/vodokanalbot:main
|
||||
```
|
||||
|
||||
### Библиотеки
|
||||
|
||||
* [Requests](https://requests.readthedocs.io/en/latest/)
|
||||
* [BeautifulSoup](https://www.crummy.com/software/BeautifulSoup/)
|
||||
|
||||
### Лицензия
|
||||
|
||||
Распространяется под MIT License. Смотри файл [`LICENSE`](./LICENSE) для того что бы узнать подробности.
|
||||
# VodokanalParser
|
2
crontab
2
crontab
@ -1,2 +0,0 @@
|
||||
@reboot cd /app && python3 /app/main.py
|
||||
*/10 * * * * cd /app && python3 /app/main.py
|
9
main.py
9
main.py
@ -20,8 +20,8 @@ if TELEGRAM_CHANNEL == '':
|
||||
# Load database
|
||||
|
||||
db = None
|
||||
if (os.path.isfile('data/db.json')):
|
||||
with open('data/db.json', 'r', encoding='utf-8') as f:
|
||||
if (os.path.isfile('db.json')):
|
||||
with open('db.json', 'r', encoding='utf-8') as f:
|
||||
db = json.load(f)
|
||||
else:
|
||||
print("Database not loaded")
|
||||
@ -71,9 +71,6 @@ else:
|
||||
|
||||
# Save database
|
||||
|
||||
if not os.path.exists("data"):
|
||||
os.makedirs("data")
|
||||
|
||||
with open('data/db.json', 'w', encoding='utf-8') as f:
|
||||
with open('db.json', 'w', encoding='utf-8') as f:
|
||||
json.dump(elements, f, ensure_ascii=False)
|
||||
print("Database updated")
|
||||
|
@ -1,2 +0,0 @@
|
||||
requests
|
||||
beautifulsoup4
|
Loading…
x
Reference in New Issue
Block a user