38 lines
910 B
Docker
38 lines
910 B
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 Selenium and its required drivers
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
wget \
|
|
curl \
|
|
unzip \
|
|
build-essential \
|
|
libsqlite3-dev \
|
|
sqlite3 \
|
|
firefox-esr \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install the required Python packages
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# 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"]
|