fix: add Dockerfile logging and force unix line endings for Docker builds

The container build fails with 'unknown instruction: curl' on line 6, which
suggests the Dockerfile continuation characters or line endings may be
malformed. Add defensive logging to diagnose:

- Force newline='\n' in all write_text calls in build_image for consistent
  Unix line endings regardless of platform
- Log compiled Dockerfile and entrypoint content at INFO/DEBUG level
- Log Dockerfile byte count when written

This will let us see exactly what Docker is receiving in the next build attempt.
This commit is contained in:
Alex Blank
2026-05-28 22:11:32 +02:00
parent 1e7bd0a540
commit fba5e7c7be
2 changed files with 9 additions and 3 deletions
+4 -3
View File
@@ -22,8 +22,9 @@ def build_image(instance_dir: str, dockerfile: str, tag: str, build_context: dic
# Write Dockerfile
dockerfile_path = Path(instance_dir) / "Dockerfile"
dockerfile_path.write_text(dockerfile)
logger.debug("Wrote Dockerfile to %s", dockerfile_path)
dockerfile_path.write_text(dockerfile, newline="\n")
logger.info("Wrote Dockerfile to %s (%d bytes)", dockerfile_path, len(dockerfile))
logger.debug("Dockerfile content:\n%s", dockerfile)
# Write build context files
if build_context:
@@ -37,7 +38,7 @@ def build_image(instance_dir: str, dockerfile: str, tag: str, build_context: dic
raise ValueError(f"Build context file path '{file_path}' escapes instance directory")
full_path.parent.mkdir(parents=True, exist_ok=True)
full_path.write_text(content)
full_path.write_text(content, newline="\n")
logger.debug("Wrote build context file: %s", full_path)
# Build image