@@ -1436,7 +1436,13 @@ func TestProjectService_PrepareServiceBuildRequest_MapsComposeFields(t *testing.
14361436 assert .Contains (t , req .ExtraHosts [0 ], "10.0.0.5" )
14371437}
14381438
1439- func TestProjectService_PrepareServiceBuildRequest_UsesExecutorVisiblePaths (t * testing.T ) {
1439+ // TestProjectService_PrepareServiceBuildRequest_KeepsContainerPaths is a
1440+ // regression test for #2314: Arcane's local build pipeline (the docker and
1441+ // buildkit providers both read the build context via the Arcane process's own
1442+ // filesystem) cannot use host paths, so prepareServiceBuildRequest must leave
1443+ // the build context and any absolute Dockerfile path as container paths even
1444+ // when the projects mount has a non-matching host prefix.
1445+ func TestProjectService_PrepareServiceBuildRequest_KeepsContainerPaths (t * testing.T ) {
14401446 svc := & ProjectService {}
14411447 proj := & composetypes.Project {WorkingDir : "/app/data/projects/demo" , Name : "demo" }
14421448 pm := projects .NewPathMapper ("/app/data/projects" , "/docker-data/arcane/projects" )
@@ -1461,8 +1467,42 @@ func TestProjectService_PrepareServiceBuildRequest_UsesExecutorVisiblePaths(t *t
14611467 )
14621468 require .NoError (t , err )
14631469
1464- assert .Equal (t , "/docker-data/arcane/projects/demo" , req .ContextDir )
1465- assert .Equal (t , "/docker-data/arcane/projects/demo/Dockerfile.custom" , req .Dockerfile )
1470+ assert .Equal (t , "/app/data/projects/demo" , req .ContextDir )
1471+ assert .Equal (t , "/app/data/projects/demo/Dockerfile.custom" , req .Dockerfile )
1472+ }
1473+
1474+ // TestProjectService_PrepareServiceBuildRequest_BuildDotKeepsContainerPath
1475+ // reproduces the exact configuration from #2314: a compose file with
1476+ // `build: .` next to its Dockerfile, on an installation where the projects
1477+ // directory is bind-mounted from a different host path than the container
1478+ // path. The resulting BuildRequest must point at the container path so the
1479+ // local builder can stat / tar the directory.
1480+ func TestProjectService_PrepareServiceBuildRequest_BuildDotKeepsContainerPath (t * testing.T ) {
1481+ svc := & ProjectService {}
1482+ proj := & composetypes.Project {WorkingDir : "/app/data/projects/caddy" , Name : "caddy" }
1483+ pm := projects .NewPathMapper ("/app/data/projects" , "/storage/volumes/arcane/projects" )
1484+
1485+ serviceCfg := composetypes.ServiceConfig {
1486+ Name : "caddy" ,
1487+ Image : "caddy" ,
1488+ Build : & composetypes.BuildConfig {
1489+ Context : "." ,
1490+ },
1491+ }
1492+
1493+ req , _ , _ , err := svc .prepareServiceBuildRequest (
1494+ context .Background (),
1495+ "project-id" ,
1496+ proj ,
1497+ "caddy" ,
1498+ serviceCfg ,
1499+ ProjectBuildOptions {},
1500+ pm ,
1501+ )
1502+ require .NoError (t , err )
1503+
1504+ assert .Equal (t , "/app/data/projects/caddy" , req .ContextDir )
1505+ assert .Equal (t , "Dockerfile" , req .Dockerfile )
14661506}
14671507
14681508func TestProjectService_PrepareServiceBuildRequest_UsesInlineDockerfile (t * testing.T ) {
0 commit comments