Spaces:
Sleeping
Sleeping
FROM python:3.8-slim-buster | |
# Install dependencies | |
RUN apt-get update && apt-get install -y \ | |
chromium \ | |
chromium-driver \ | |
libglib2.0-0 \ | |
libnss3 \ | |
libx11-6 \ | |
libx11-xcb1 \ | |
libxcb1 \ | |
libxcomposite1 \ | |
libxcursor1 \ | |
libxdamage1 \ | |
libxi6 \ | |
libxrandr2 \ | |
libxrender1 \ | |
libxss1 \ | |
libxtst6 \ | |
xdg-utils \ | |
pandoc \ | |
fonts-noto-cjk \ | |
&& rm -rf /var/lib/apt/lists/* | |
RUN groupadd -r myuser && useradd -r -g myuser myuser | |
# Set environment variables | |
ENV CHROME_BIN=/usr/bin/chromium-browser | |
ENV CHROME_PATH=/usr/lib/chromium/ | |
WORKDIR /app | |
# Copy requirements and install them | |
COPY requirements.txt requirements.txt | |
RUN pip3 install -r requirements.txt | |
# Copy the application code | |
COPY . . | |
RUN chown -R myuser:myuser /app | |
# Expose port 7860 | |
EXPOSE 7860 | |
USER myuser | |
# Run the application | |
CMD ["python3", "app.py", "--host", "0.0.0.0", "--port", "7860"] | |