36 lines
1.4 KiB
Docker
36 lines
1.4 KiB
Docker
# Utilise une image officielle de Python avec les outils nécessaires
|
|
FROM python:3.9-slim
|
|
|
|
# Installe les dépendances requises pour Selenium et Chrome
|
|
RUN apt-get update && apt-get install -y \
|
|
curl unzip wget xvfb \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Télécharge et installe Google Chrome
|
|
RUN wget -qO- https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /usr/share/keyrings/google-keyring.gpg \
|
|
&& echo "deb [signed-by=/usr/share/keyrings/google-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google-chrome.list \
|
|
&& apt-get update \
|
|
&& apt-get install -y google-chrome-stable \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Télécharge et installe le ChromeDriver correspondant
|
|
RUN CHROME_VERSION=$(google-chrome --version | awk '{print $3}' | cut -d '.' -f 1) \
|
|
&& wget -O /tmp/chromedriver.zip "https://chromedriver.storage.googleapis.com/${CHROME_VERSION}.0/chromedriver_linux64.zip" \
|
|
&& unzip /tmp/chromedriver.zip -d /usr/local/bin/ \
|
|
&& rm /tmp/chromedriver.zip \
|
|
&& chmod +x /usr/local/bin/chromedriver
|
|
|
|
# Définit le répertoire de travail
|
|
WORKDIR /app
|
|
|
|
# Copie les fichiers nécessaires
|
|
COPY requirements.txt .
|
|
COPY .env .
|
|
COPY nvidia-stock-bot-web.py ./script.py # Adapte le nom du fichier si nécessaire
|
|
|
|
# Installe les dépendances Python
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Commande pour exécuter le script
|
|
CMD ["python", "script.py"]
|