Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
9bb8e8d3d7 | |||
66c4146223 |
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
|
||||||
```
|
```
|
||||||
|
@ -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