mirror of
https://github.com/serega404/MetricAliexpressExchangeRate.git
synced 2025-04-21 06:10:44 +03:00
Add docker support
This commit is contained in:
parent
bc0b2afb38
commit
5b808df1c2
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
FROM python:3.11.1-alpine3.17
|
||||||
|
|
||||||
|
LABEL Maintainer="serega404"
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY main.py main.py
|
||||||
|
COPY ./requirements.txt requirements.txt
|
||||||
|
RUN pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
COPY crontab /etc/cron.d/crontab
|
||||||
|
RUN chmod 0644 /etc/cron.d/crontab
|
||||||
|
|
||||||
|
RUN /usr/bin/crontab /etc/cron.d/crontab
|
||||||
|
|
||||||
|
# run crond as main process of container
|
||||||
|
CMD ["/usr/sbin/crond", "-f"]
|
13
README.md
13
README.md
@ -20,6 +20,19 @@
|
|||||||
|
|
||||||
<img src="./grafana.png" width="400" height="300" />
|
<img src="./grafana.png" width="400" height="300" />
|
||||||
|
|
||||||
|
### Запуск в Docker
|
||||||
|
|
||||||
|
``` Docker
|
||||||
|
docker run -d --name MetricAliexpressExchangeRate \
|
||||||
|
--restart=always \
|
||||||
|
-e METRIC_SERVER_URL='http(s)://<IP_ADDR>:<PORT>/' \
|
||||||
|
repo/container:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Дополнительные переменные среды:
|
||||||
|
* `CBRF_APISITE_URL`
|
||||||
|
* `ALI1USD_PAGE_URL`
|
||||||
|
|
||||||
### Библиотеки
|
### Библиотеки
|
||||||
|
|
||||||
* [BeautifulSoup](https://www.crummy.com/software/BeautifulSoup/)
|
* [BeautifulSoup](https://www.crummy.com/software/BeautifulSoup/)
|
||||||
|
8
main.py
8
main.py
@ -1,11 +1,11 @@
|
|||||||
import requests, re, json
|
import requests, re, json, os
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
# Config
|
# Config
|
||||||
|
|
||||||
Ali1USDPageURL = 'https://aliexpress.ru/item/32892046259.html'
|
Ali1USDPageURL = os.environ.get('ALI1USD_PAGE_URL', 'https://aliexpress.ru/item/32892046259.html')
|
||||||
CBRFApiSiteURL = 'https://www.cbr-xml-daily.ru/daily_json.js'
|
CBRFApiSiteURL = os.environ.get('CBRF_APISITE_URL', 'https://www.cbr-xml-daily.ru/daily_json.js')
|
||||||
MetricServerURL = 'http://192.168.0.100:8428/'
|
MetricServerURL = os.environ.get('METRIC_SERVER_URL', 'http://192.168.0.100:8428/')
|
||||||
|
|
||||||
KursAli = ""
|
KursAli = ""
|
||||||
KursCBRF = ""
|
KursCBRF = ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user