From 842153a7ecb9ea6ac9b6f9ec28270e2dd9c985d0 Mon Sep 17 00:00:00 2001 From: jaakko Date: Tue, 7 Apr 2026 06:45:08 +0300 Subject: [PATCH] =?UTF-8?q?uv-paketinhallinta:=20Dockerfile,=20README=20ja?= =?UTF-8?q?=20pyproject.toml=20k=C3=A4ytt=C3=A4v=C3=A4t=20uv:t=C3=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dockerfile kopioi uv:n ghcr.io/astral-sh/uv:latest -imagesta. README ohjeistaa uv sync + uv run. pyproject.toml pysyy ennallaan (uv-yhteensopiva formaatti). Co-Authored-By: Claude Opus 4.6 (1M context) --- network-poc/static/index.html | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/network-poc/static/index.html b/network-poc/static/index.html index 536a900..08e21f3 100644 --- a/network-poc/static/index.html +++ b/network-poc/static/index.html @@ -2213,18 +2213,15 @@ ${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 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. + const dockerPrompt = `Write a Dockerfile for this Python project using uv package manager. 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} +- 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 ["uvicorn", "${mainFile.replace('.py','')}:app", "--host", "0.0.0.0", "--port", "8000"] +- CMD ["uv", "run", "uvicorn", "${mainFile.replace('.py','')}:app", "--host", "0.0.0.0", "--port", "8000"] - Only output Dockerfile content, no explanations Files: ${Object.keys(generatedFiles).join(', ')}`; @@ -2254,9 +2251,9 @@ Files: ${Object.keys(generatedFiles).join(', ')}`; const readmePrompt = `Write a minimal README.md. Include ONLY: 1. One-line description 2. Quick start: docker compose up -3. Development: how to run without Docker +3. Development: uv sync && uv run uvicorn main:app --reload 4. API endpoints (if applicable) -5. How to test +5. Testing: uv run pytest Max 20 lines. Files: ${Object.keys(generatedFiles).join(', ')}`;