Poetry install tries to install the app before source files exist
Summary: The Dockerfile copies only pyproject.toml, then runs poetry install. Poetry attempts to install the root project and fails because package metadata/source files are not present yet.
Failure type: poetry_root_install_order
Ecosystem: python
Difficulty: medium

Repository files:
path: Dockerfile
content: FROM python:3.12-slim
WORKDIR /app
RUN pip install --no-cache-dir poetry==1.8.3
COPY pyproject.toml ./
RUN poetry install --only main
COPY service ./service
CMD ["poetry", "run", "python", "-m", "service"]
path: pyproject.toml
content: [tool.poetry]
name = "sbd0008"
version = "0.1.0"
description = "synthetic task"
authors = ["Sabnock <bench@example.com>"]
packages = [{ include = "service" }]
[tool.poetry.dependencies]
python = "^3.12"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
path: service/__main__.py
content: print("ok")

Failure log:
Installing the current project: sbd0008 (0.1.0)
Error: The current project could not be installed: No file/folder found for package service

Build command: docker build -t sabnock/sbd-0008 .
Verify commands:
docker build -t sabnock/sbd-0008 .

Oracle patch:
diff --git a/Dockerfile b/Dockerfile
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,6 +2,6 @@
 WORKDIR /app
 RUN pip install --no-cache-dir poetry==1.8.3
 COPY pyproject.toml ./
-RUN poetry install --only main
+RUN poetry install --only main --no-root
 COPY service ./service
 CMD ["poetry", "run", "python", "-m", "service"]

Scoring - must touch:
Dockerfile
Scoring - must contain:
path: Dockerfile
text: poetry install --only main --no-root
Scoring - must not contain: