Spaces:
Paused
Paused
| # Create Dockerfile | |
| with open(f"{base_dir}/Dockerfile", "w") as f: | |
| f.write('''FROM python:3.11-slim | |
| WORKDIR /app | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY . . | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] | |
| ''') | |
| # Create .gitignore | |
| with open(f"{base_dir}/.gitignore", "w") as f: | |
| f.write('''.env | |
| __pycache__/ | |
| *.pyc | |
| *.pyo | |
| *.pyd | |
| .Python | |
| *.so | |
| *.egg | |
| *.egg-info/ | |
| dist/ | |
| build/ | |
| *.log | |
| *.json | |
| sandbox/ | |
| !memory.json | |
| !swarm.log | |
| ''') | |
| # Now create a zip of the entire project for easy download | |
| import shutil | |
| zip_path = "/mnt/agents/output/swarm-cli.zip" | |
| shutil.make_archive("/mnt/agents/output/swarm-cli", 'zip', base_dir) | |
| print(f"Project zip created: {zip_path}") | |
| print(f"Size: {os.path.getsize(zip_path) / 1024:.1f} KB") |