Spaces:
Running
Running
FROM python:3.11-slim-bullseye as builder | |
# Build dummy packages to skip installing them and their dependencies | |
RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends equivs \ | |
&& equivs-control libgl1-mesa-dri \ | |
&& printf 'Section: misc\nPriority: optional\nStandards-Version: 3.9.2\nPackage: libgl1-mesa-dri\nVersion: 99.0.0\nDescription: Dummy package for libgl1-mesa-dri\n' >> libgl1-mesa-dri \ | |
&& equivs-build libgl1-mesa-dri \ | |
&& mv libgl1-mesa-dri_*.deb /libgl1-mesa-dri.deb \ | |
&& equivs-control adwaita-icon-theme \ | |
&& printf 'Section: misc\nPriority: optional\nStandards-Version: 3.9.2\nPackage: adwaita-icon-theme\nVersion: 99.0.0\nDescription: Dummy package for adwaita-icon-theme\n' >> adwaita-icon-theme \ | |
&& equivs-build adwaita-icon-theme \ | |
&& mv adwaita-icon-theme_*.deb /adwaita-icon-theme.deb | |
FROM python:3.11-slim-bullseye | |
COPY --from=builder /*.deb / | |
WORKDIR /app | |
RUN echo "deb http://deb.debian.org/debian/ unstable main contrib non-free" >> /etc/apt/sources.list | |
RUN apt update | |
RUN apt install -y python3 python3-pip libgl1-mesa-glx wget libglib2.0-dev sudo libpci-dev psmisc | |
RUN pip install playwright hcaptcha_challenger requests loguru flask Flask-Limiter | |
RUN dpkg -i /libgl1-mesa-dri.deb \ | |
&& dpkg -i /adwaita-icon-theme.deb \ | |
# Install dependencies | |
&& apt-get update \ | |
&& apt-get install -y --no-install-recommends xvfb dumb-init \ | |
procps curl vim xauth \ | |
# Remove temporary files and hardware decoding libraries | |
&& rm -rf /var/lib/apt/lists/* \ | |
&& rm -f /usr/lib/x86_64-linux-gnu/libmfxhw* \ | |
&& rm -f /usr/lib/x86_64-linux-gnu/mfx/* \ | |
&& useradd --home-dir /app --shell /bin/sh foxer \ | |
&& chown -R foxer:foxer . | |
RUN rm -rf /root/.cache | |
RUN chmod 777 -R "/usr/local/lib/python3.11/" | |
RUN chmod 777 -R "/app/" | |
RUN playwright install firefox --with-deps | |
USER foxer | |
RUN playwright install firefox | |
COPY hcaptcha_solver.py . | |
COPY api.py . | |
EXPOSE 8081 | |
ENTRYPOINT ["/usr/bin/dumb-init", "--"] | |
CMD ["/usr/local/bin/python","-u","/app/api.py"] | |