| |
| 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"] |
|
|