[Python] Simple error: Hugging Face Dockerfile Specific , directory error [closed]

Discussão em 'Python' iniciado por Stack, Março 25, 2025.

  1. Stack

    Stack Membro Participativo

    # ✅ Step 1: Use a lightweight Python image

    FROM python:3.10-slim



    # ✅ Step 2: Create a non-root user for better security

    RUN useradd -m -u 1000 user



    # ✅ Step 3: Install Git (needed for cloning)

    RUN apt-get update && apt-get install -y --no-install-recommends git \

    && rm -rf /var/lib/apt/lists/*



    # ✅ Step 4: Set the working directory

    WORKDIR /app



    # ✅ Step 5: Clone the repository

    RUN git clone --depth=1 https://github.com/SeouDr00/OneFile.git .



    # ✅ Step 6: Switch to the non-root user

    USER user



    # ✅ Step 7: Debugging – Install 'psutil' for system diagnostics

    RUN pip install --no-cache-dir psutil



    # ✅ Step 8: Install dependencies from `requirements.txt`

    COPY --chown=user:user requirements.txt /app/requirements.txt

    RUN pip install --no-cache-dir -r /app/requirements.txt



    # ✅ Step 9: Create the sessions directory and set correct permissions

    RUN mkdir -p /app/sessions && chmod 777 /app/sessions

    RUN ls -ld /app/sessions # Debugging



    # ✅ Step 10: Debugging – Check disk space and user ID

    RUN python -c "import psutil; print(psutil.disk_usage('/'))"

    RUN id



    # ✅ Step 11: Copy all files and set execution permission on `bot.py`

    COPY --chown=user:user . /app

    RUN chmod +x /app/bot.py



    # ✅ Step 12: Set environment variables

    ENV API_ID=283805

    ENV API_HASH=8f80142dfef1a69b4f6ece34

    ENV BOT_TOKEN=7227094800:AAHoeFOgeJbLnxnwbKKeRjHT4Ba5A

    ENV POSTGRES_URI=postgres://avnadmin:AVNS_DLTo9WK_5HY9SY@pg-
    4d-anup-84fe.g.aivencloud.com:14318/defaultdb?sslmode=require

    ENV SESSION_DIR=/app/sessions



    # ✅ Step 13: Entrypoint with Debugging

    CMD ["bash", "-c", "ls -ld /app/sessions && whoami && python bot.py"]



    # ✅ Step 14: Healthcheck (Runs as non-root user)

    HEALTHCHECK --interval=30s --timeout=5s --start-period=60s \

    CMD python -c "import pyrogram, os; pyrogram.Client(name=os.environ.get('SESSION_DIR')+'/pyrogram_session', api_id=int(os.environ.get('API_ID')), api_hash=os.environ.get('API_HASH'), bot_token=os.environ.get('BOT_TOKEN')).start().stop()"



    Error:

    ==== Build Queued at 2025-02-26 09:57:02 / Commit SHA: 4bc7bf1 =====



    --> FROM docker.io/library/python:3.10-slim@sha256:f680fc3f447366d9be2ae53dc7a6447fe9b33311af209225783932704f0cb4e7

    DONE 0.0s



    --> WORKDIR /app

    CACHED



    --> RUN git clone --depth=1 https://github.com/SeoulDr0/OneFile.git .

    CACHED



    --> RUN pip install --no-cache-dir psutil

    CACHED



    --> RUN useradd -m -u 1000 user

    CACHED



    --> RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*

    CACHED



    --> COPY --chown=user:user ./requirements.txt ./requirements.txt



    --> ERROR: failed to calculate checksum of ref v1kpz28g1todrhc04me68kqd8::x0i5wvi91do1ixmgpugtxhd6j: "/requirements.txt": not found

    Continue reading...

Compartilhe esta Página