diff --git a/network-poc/static/index.html b/network-poc/static/index.html index be2d1fb..536a900 100644 --- a/network-poc/static/index.html +++ b/network-poc/static/index.html @@ -2212,14 +2212,22 @@ ${Object.entries(generatedFiles).map(([n, c]) => `--- ${n} ---\n${c}`).join('\n\ const step6 = step5 + 1; termLog(`\n[${step6}] DevOps — Dockerfile`); pipelineStep('tester', 'Dockerfile', 'active', 'Dockerfile'); - const dockerPrompt = `Write a Dockerfile for this project. Use multi-stage build: -- Stage 1 (builder): install dependencies -- Stage 2 (runtime): copy only what's needed, minimal image -Use python:3.12-slim as base. EXPOSE the correct port. CMD to start the app. -Only output the Dockerfile content, nothing else. + const mainFile = Object.keys(generatedFiles).find(f => f.includes('main') || f.includes('app')) || Object.keys(generatedFiles)[0]; + const hasPyproject = Object.keys(generatedFiles).some(f => f === 'pyproject.toml'); + const hasRequirements = Object.keys(generatedFiles).some(f => f === 'requirements.txt'); + const depInstall = hasPyproject ? 'COPY pyproject.toml ./\nRUN pip install --no-cache-dir .' : hasRequirements ? 'COPY requirements.txt ./\nRUN pip install --no-cache-dir -r requirements.txt' : 'RUN pip install --no-cache-dir fastapi uvicorn'; + const dockerPrompt = `Write a Dockerfile for this Python project. -Files: ${Object.keys(generatedFiles).join(', ')} -Main app entry: ${Object.keys(generatedFiles).find(f => f.includes('main') || f.includes('app')) || Object.keys(generatedFiles)[0]}`; +RULES: +- Base: python:3.12-slim (single stage, no multi-stage needed for Python) +- Install deps with pip ONLY (no poetry, no pipenv, no conda) +- ${depInstall} +- COPY all .py files +- EXPOSE 8000 +- CMD ["uvicorn", "${mainFile.replace('.py','')}:app", "--host", "0.0.0.0", "--port", "8000"] +- Only output Dockerfile content, no explanations + +Files: ${Object.keys(generatedFiles).join(', ')}`; const dockerfile = await kpnRun(agentPrompts.tester.model, dockerPrompt, false, 256); if (dockerfile) generatedFiles['Dockerfile'] = dockerfile; pipelineStep('tester', 'Dockerfile', 'done', 'Dockerfile', dockerfile);