| FROM node:18 | |
| WORKDIR /app | |
| # Устанавливаем Python | |
| RUN apt-get update && apt-get install -y \ | |
| python3 \ | |
| python3-pip \ | |
| python3-venv \ | |
| git \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Копируем файлы API wrapper и конфигурации | |
| COPY api_wrapper.py /app/ | |
| COPY app.py /app/ | |
| COPY proxy.py /app/ | |
| COPY .space/hf-space.sh /app/ | |
| # Создаем директории | |
| RUN mkdir -p /tmp/ten_user/agents /tmp/ten_user/logs /app/backup /tmp/ten_playground | |
| RUN chmod -R 777 /tmp/ten_playground | |
| # Создаем и активируем виртуальную среду Python | |
| RUN python3 -m venv /app/venv | |
| ENV PATH="/app/venv/bin:$PATH" | |
| # Устанавливаем Python зависимости в виртуальную среду | |
| COPY requirements.txt /app/ | |
| RUN pip install --no-cache-dir -U pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Клонируем репозиторий TEN-Agent | |
| RUN git clone --depth 1 https://github.com/TEN-framework/TEN-Agent.git /tmp/ten-agent | |
| # Копируем только необходимые файлы из репозитория | |
| RUN mkdir -p /app/playground | |
| RUN cp -r /tmp/ten-agent/playground/* /app/playground/ | |
| RUN rm -rf /tmp/ten-agent | |
| # Устанавливаем pnpm и next глобально для использования с npx | |
| RUN npm install -g pnpm@8 next@latest | |
| # Возвращаемся в основную директорию | |
| WORKDIR /app | |
| # Делаем скрипт запуска исполняемым | |
| RUN chmod +x /app/hf-space.sh | |
| # Экспортируем порт | |
| EXPOSE 7860 3000 8080 | |
| # Запускаем приложение через скрипт | |
| COPY start.sh /app/ | |
| RUN chmod +x /app/start.sh | |
| CMD ["/app/start.sh"] | |