FROM python:3.11-slim # ----------------------- # System deps # ----------------------- WORKDIR /app RUN apt-get update && apt-get install -y \ curl \ gnupg \ git \ libgl1 \ libglib2.0-0 \ && curl -sL https://deb.nodesource.com/setup_20.x | bash - \ && apt-get install -y nodejs \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # ----------------------- # Install gh CLI # ----------------------- RUN mkdir -p -m 755 /etc/apt/keyrings \ && curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/etc/apt/keyrings/githubcli-archive-keyring.gpg \ && chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ && apt-get update \ && apt-get install -y gh \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # ----------------------- # Git stability fixes (CRITICAL) # ----------------------- RUN git config --global http.version HTTP/1.1 \ && git config --global core.compression 0 # ----------------------- # Python deps (as root) # ----------------------- COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # ----------------------- # Create HF user # ----------------------- RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # ----------------------- # App code # ----------------------- WORKDIR /home/user/app COPY --chown=user . . # ----------------------- # Frontend build # ----------------------- WORKDIR /home/user/app/social_media_publishers/frontend RUN npm install && npm run build WORKDIR /home/user/app # ----------------------- # Runtime # ----------------------- EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]