File size: 1,154 Bytes
126cf9c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# hk-dyback v2.6 HuggingFace Spaces
FROM python:3.11-slim-bookworm

RUN apt-get update && apt-get install -y --no-install-recommends \
        curl unzip ca-certificates tini \
    && curl -fsSL https://dl.google.com/android/repository/platform-tools-latest-linux.zip -o /tmp/pt.zip \
    && unzip -q /tmp/pt.zip -d /opt/ \
    && ln -sf /opt/platform-tools/adb /usr/local/bin/adb \
    && rm -f /tmp/pt.zip \
    && apt-get purge -y unzip curl \
    && apt-get autoremove -y \
    && rm -rf /var/lib/apt/lists/*

RUN pip install --no-cache-dir \
        fastapi uvicorn paramiko python-dotenv "sse-starlette>=2.0"

RUN useradd -m -u 1000 user

USER user
WORKDIR /home/user/app

COPY --chown=user:user app.py conn.py restore.py sync.py d1db.py hubble.py ./
COPY --chown=user:user data/ ./data/
COPY --chown=user:user static/ ./static/
COPY --chown=user:user .env.example ./

RUN mkdir -p /home/user/.android /home/user/app/logs \
    && chmod 700 /home/user/.android

ENV PYTHONUNBUFFERED=1 \
    PATH=/usr/local/bin:/usr/bin:/bin

EXPOSE 7860
ENTRYPOINT ["tini", "--"]
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]