mirror of
				https://github.com/serega404/MetricAliexpressExchangeRate.git
				synced 2025-11-01 02:00:37 +03:00 
			
		
		
		
	Compare commits
	
		
			4 Commits
		
	
	
		
			f0f34979c4
			...
			4b822855a7
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 4b822855a7 | |||
| f4ce9083ae | |||
| 5b808df1c2 | |||
| bc0b2afb38 | 
							
								
								
									
										41
									
								
								.github/workflows/github-push-docker.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								.github/workflows/github-push-docker.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | |||||||
|  | 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 }} | ||||||
							
								
								
									
										18
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | |||||||
|  | FROM python:3.11.1-alpine3.17 | ||||||
|  |  | ||||||
|  | LABEL Maintainer="serega404" | ||||||
|  |  | ||||||
|  | WORKDIR /app | ||||||
|  |  | ||||||
|  | COPY ./requirements.txt requirements.txt | ||||||
|  | RUN pip3 install -r requirements.txt | ||||||
|  |  | ||||||
|  | COPY crontab /etc/cron.d/crontab | ||||||
|  | RUN chmod 0644 /etc/cron.d/crontab | ||||||
|  |  | ||||||
|  | COPY main.py main.py | ||||||
|  |  | ||||||
|  | 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>/' \ | ||||||
|  |     ghcr.io/serega404/metricaliexpressexchangerate:main | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | #### Дополнительные переменные среды: | ||||||
|  | * `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 = "" | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | |||||||
|  | requests | ||||||
|  | beautifulsoup4 | ||||||
		Reference in New Issue
	
	Block a user