diff --git a/network-poc/static/index.html b/network-poc/static/index.html index 9c975cc..68a8a29 100644 --- a/network-poc/static/index.html +++ b/network-poc/static/index.html @@ -2287,24 +2287,28 @@ ${Object.entries(generatedFiles).map(([n, c]) => `--- ${n} ---\n${c}`).join('\n\ pipelineStep('tester', 'Dockerfile', 'active', 'Dockerfile'); const mainFile = Object.keys(generatedFiles).find(f => f.includes('main') || f.includes('app')) || Object.keys(generatedFiles)[0]; const hasPyproject = 'pyproject.toml' in generatedFiles; + const hasRequirements = 'requirements.txt' 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. - -FROM python:3.12-slim + // Dockerfile-templatti: ei anneta mallin keksiä omaa + let depLines; + if (hasPyproject) { + depLines = 'COPY pyproject.toml .\nRUN uv sync --no-dev'; + } else if (hasRequirements) { + depLines = 'COPY requirements.txt .\nRUN uv pip install --system -r requirements.txt'; + } else { + depLines = 'RUN uv pip install --system fastapi uvicorn'; + } + const dockerfileContent = `FROM python:3.12-slim COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv WORKDIR /app -${depStep} +${depLines} COPY ${pyFiles.join(' ')} ./ EXPOSE 8000 -CMD ["uv", "run", "uvicorn", "${mainFile.replace('.py','')}:app", "--host", "0.0.0.0", "--port", "8000"] - -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); +CMD ["uv", "run", "uvicorn", "${mainFile.replace('.py','')}:app", "--host", "0.0.0.0", "--port", "8000"]`; + // Generoidaan Dockerfile suoraan templatesta, ei mallilla + generatedFiles['Dockerfile'] = dockerfileContent; + termLog(` Dockerfile generoitu (template)`); + pipelineStep('tester', 'Dockerfile', 'done', dockerfileContent, dockerfileContent); // Vaihe 7: DevOps — docker-compose.yml const step7 = step6 + 1;