diff --git a/network-poc/static/index.html b/network-poc/static/index.html index 6e476d7..0400d5e 100644 --- a/network-poc/static/index.html +++ b/network-poc/static/index.html @@ -2250,18 +2250,22 @@ ${Object.entries(generatedFiles).map(([n, c]) => `--- ${n} ---\n${c}`).join('\n\ termLog(`\n[${step6}] DevOps — Dockerfile`); pipelineStep('tester', 'Dockerfile', 'active', 'Dockerfile'); const mainFile = Object.keys(generatedFiles).find(f => f.includes('main') || f.includes('app')) || Object.keys(generatedFiles)[0]; - const dockerPrompt = `Write a Dockerfile for this Python project using uv package manager. + const hasPyproject = 'pyproject.toml' in generatedFiles; + const pyFiles = Object.keys(generatedFiles).filter(f => f.endsWith('.py')); + const depStep = hasPyproject + ? 'COPY pyproject.toml .\nRUN uv sync --no-dev' + : `RUN uv pip install --system fastapi uvicorn sqlalchemy`; + const dockerPrompt = `Write a Dockerfile. Output ONLY the Dockerfile, nothing else. -RULES: -- Base: python:3.12-slim -- Install uv: COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv -- COPY pyproject.toml and then: RUN uv sync --no-dev -- COPY all .py files -- EXPOSE 8000 -- CMD ["uv", "run", "uvicorn", "${mainFile.replace('.py','')}:app", "--host", "0.0.0.0", "--port", "8000"] -- Only output Dockerfile content, no explanations +FROM python:3.12-slim +COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv +WORKDIR /app +${depStep} +COPY ${pyFiles.join(' ')} ./ +EXPOSE 8000 +CMD ["uv", "run", "uvicorn", "${mainFile.replace('.py','')}:app", "--host", "0.0.0.0", "--port", "8000"] -Files: ${Object.keys(generatedFiles).join(', ')}`; +Adapt this template if needed. Project 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);