|
|
FROM python:3.8-slim |
|
|
|
|
|
|
|
|
RUN useradd -m -u 1000 appuser |
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
|
xvfb \ |
|
|
chromium \ |
|
|
chromium-driver \ |
|
|
xauth \ |
|
|
wget \ |
|
|
gnupg \ |
|
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
COPY . . |
|
|
|
|
|
|
|
|
COPY requirements.txt . |
|
|
RUN pip install -r requirements.txt |
|
|
|
|
|
|
|
|
RUN mkdir -p /tmp/.X11-unix && \ |
|
|
chmod 1777 /tmp/.X11-unix && \ |
|
|
mkdir -p /tmp/matplotlib && \ |
|
|
chown -R appuser:appuser /tmp/matplotlib && \ |
|
|
chown -R appuser:appuser /app |
|
|
|
|
|
|
|
|
RUN echo '#!/bin/bash\nXvfb :99 -screen 0 1024x768x16 &\nexport DISPLAY=:99\nexport MPLCONFIGDIR=/tmp/matplotlib\npython app.py' > /app/start.sh && \ |
|
|
chmod +x /app/start.sh |
|
|
|
|
|
|
|
|
USER appuser |
|
|
|
|
|
|
|
|
ENV DISPLAY=:99 |
|
|
ENV MPLCONFIGDIR=/tmp/matplotlib |
|
|
|
|
|
|
|
|
CMD ["/app/start.sh"] |