Compare commits
5 Commits
28991dd7a7
...
v3.1
Author | SHA1 | Date | |
---|---|---|---|
9bb8e8d3d7 | |||
66c4146223 | |||
92edccd8d8 | |||
a2561a79b8 | |||
d4735e32b3 |
12
Dockerfile
12
Dockerfile
@ -1,22 +1,16 @@
|
|||||||
# Utiliser une image de base légère de Python (ici Python 3.9)
|
FROM python:3.11-alpine
|
||||||
FROM python:3.9-slim
|
|
||||||
|
RUN apk add --no-cache ca-certificates
|
||||||
|
|
||||||
# Définir le répertoire de travail à l'intérieur du conteneur
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copier le script Python dans le répertoire de travail
|
|
||||||
COPY nvidia-stock-bot.py /app/
|
COPY nvidia-stock-bot.py /app/
|
||||||
|
|
||||||
# Copier un éventuel fichier requirements.txt pour installer des dépendances
|
|
||||||
# Si des dépendances supplémentaires sont nécessaires, ajoutez-les dans requirements.txt
|
|
||||||
COPY requirements.txt /app/
|
COPY requirements.txt /app/
|
||||||
|
|
||||||
# Installer les dépendances Python à partir de requirements.txt
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Définir les variables d'environnement par défaut (modifiable lors du lancement du conteneur)
|
|
||||||
ENV DISCORD_WEBHOOK_URL="https://example.com/webhook" \
|
ENV DISCORD_WEBHOOK_URL="https://example.com/webhook" \
|
||||||
REFRESH_TIME="30"
|
REFRESH_TIME="30"
|
||||||
|
|
||||||
# Exposer un point de commande pour exécuter le script
|
|
||||||
CMD ["python", "nvidia-stock-bot.py"]
|
CMD ["python", "nvidia-stock-bot.py"]
|
@ -58,7 +58,6 @@ services:
|
|||||||
- API_URL_SKU= # API listing the product
|
- API_URL_SKU= # API listing the product
|
||||||
- API_URL_STOCK= # API providing stock data
|
- API_URL_STOCK= # API providing stock data
|
||||||
- PRODUCT_URL= # GPU purchase URL
|
- PRODUCT_URL= # GPU purchase URL
|
||||||
|
|
||||||
- PYTHONUNBUFFERED=1 # Enables real-time log output
|
- PYTHONUNBUFFERED=1 # Enables real-time log output
|
||||||
command: python nvidia-stock-bot.py
|
command: python nvidia-stock-bot.py
|
||||||
```
|
```
|
||||||
@ -69,11 +68,11 @@ services:
|
|||||||
|---------------------|-------------------------------------------------|------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
|
|---------------------|-------------------------------------------------|------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
|
||||||
| `DISCORD_WEBHOOK_URL` | Your Discord webhook URL | A valid URL | |
|
| `DISCORD_WEBHOOK_URL` | Your Discord webhook URL | A valid URL | |
|
||||||
| `PRODUCT_NAMES` | The exact GPU names you're searching for | `RTX 5080, RTX 5090` | |
|
| `PRODUCT_NAMES` | The exact GPU names you're searching for | `RTX 5080, RTX 5090` | |
|
||||||
| `DISCORD_ROLE>` | List of Discord roles ID in the same order than `PRODUCT_NAMES` values, found in your discord server settings (with user profile developer mode enabled) | `<@&12345><@&6789>` | @everyone |
|
| `DISCORD_ROLES` | List of Discord roles ID in the same order than `PRODUCT_NAMES` values, found in your discord server settings (with user profile developer mode enabled) | `<@&12345><@&6789>` | @everyone |
|
||||||
| `REFRESH_TIME` | Script refresh interval in seconds | `60`, `30`, etc. | `30` |
|
| `REFRESH_TIME` | Script refresh interval in seconds | `60`, `30`, etc. | `30` |
|
||||||
| `API_URL_SKU` | API listing the product | A URL. API url can change over time. For now, you can use the default one and change the `locale` parameter to yours (for exemple : `locale=en-gb`) | `https://api.nvidia.partners/edge/product/search?page=1&limit=100&locale=fr-fr&Manufacturer=Nvidia` |
|
| `API_URL_SKU` | API listing the product | A URL. API url can change over time. For now, you can use the default one and change the `locale` parameter to yours (e.g. `locale=en-gb`) | `https://api.nvidia.partners/edge/product/search?page=1&limit=100&locale=fr-fr&Manufacturer=Nvidia` |
|
||||||
| `API_URL_STOCK` | API providing stock data | A URL. API url can change over time. For now, you can use the default one and change the `locale` parameter to yours (for exemple : `locale=en-gb`) | `https://api.store.nvidia.com/partner/v1/feinventory?locale=fr-fr&skus=` |
|
| `API_URL_STOCK` | API providing stock data | A URL. API url can change over time. For now, you can use the default one and change the `locale` parameter to yours (e.g. `locale=en-gb`) | `https://api.store.nvidia.com/partner/v1/feinventory?locale=fr-fr&skus=` |
|
||||||
| `PRODUCT_URL` | GPU purchase URL | A URL. API url can change over time. For now, you can use the default one and change the `locale` parameter to yours (for exemple : `/en-gb/`) | `https://marketplace.nvidia.com/fr-fr/consumer/graphics-cards/?locale=fr-fr&page=1&limit=12&manufacturer=NVIDIA` |
|
| `PRODUCT_URL` | GPU purchase URL. There isn't any direct link workinf right now, so put the generic marketplace url listing all FE products | A URL. API url can change over time. For now, you can use the default one and change the locale parameter to yours (e.g. `/en-gb/`) | `https://marketplace.nvidia.com/fr-fr/consumer/graphics-cards/?locale=fr-fr&page=1&limit=12&manufacturer=NVIDIA` |
|
||||||
| `TEST_MODE` | For testing without sending notifications | `True`, `False` | `False` |
|
| `TEST_MODE` | For testing without sending notifications | `True`, `False` | `False` |
|
||||||
| `PYTHONUNBUFFERED` | Enables real-time log output | `1`, `0` | `1` |
|
| `PYTHONUNBUFFERED` | Enables real-time log output | `1`, `0` | `1` |
|
||||||
|
|
||||||
|
@ -350,8 +350,10 @@ def check_rtx_50_founders():
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
|
start = time.time()
|
||||||
check_rtx_50_founders()
|
check_rtx_50_founders()
|
||||||
time.sleep(REFRESH_TIME)
|
elapsed = time.time() - start
|
||||||
|
time.sleep(max(0, REFRESH_TIME - elapsed))
|
||||||
|
|
||||||
# Gracefully shut down
|
# Gracefully shut down
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
Reference in New Issue
Block a user