SecretarX/Dockerfile
2024-09-10 14:11:50 +02:00

41 lines
1.1 KiB
Docker

# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set environment variable to prevent Python from buffering its outputs
ENV PYTHONUNBUFFERED=1
# Set the working directory inside the container
WORKDIR /app
# Copy the local requirements file to the container
COPY requirements.txt /app/requirements.txt
# Install the required Python packages
RUN pip install --no-cache-dir -r requirements.txt
# Install Selenium and its required drivers
RUN apt-get update && \
apt-get install -y --no-install-recommends \
wget \
curl \
unzip \
chromium-driver \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Set up Chrome WebDriver for Selenium
RUN wget -q -O /app/chromedriver.zip https://chromedriver.storage.googleapis.com/114.0.5735.90/chromedriver_linux64.zip && \
unzip /app/chromedriver.zip && \
chmod +x /app/chromedriver && \
rm /app/chromedriver.zip
# Set environment variables for Chrome and ChromeDriver
ENV PATH=/app:$PATH
ENV DISPLAY=:99
# Copy the rest of the application code to the container
COPY . /app
# Start the bot
CMD ["python", "main.py"]