diff --git a/internal/service/deploy/deploy.go b/internal/service/deploy/deploy.go index e72aad9..6065eb0 100644 --- a/internal/service/deploy/deploy.go +++ b/internal/service/deploy/deploy.go @@ -205,17 +205,18 @@ func (svc *Service) cloneRepository( deployment *models.Deployment, ) (string, func(), error) { // Use a subdirectory of DataDir for builds since it's mounted from the host - // and accessible to Docker for bind mounts (unlike /tmp inside the container) - buildsDir := filepath.Join(svc.config.DataDir, "builds") + // and accessible to Docker for bind mounts (unlike /tmp inside the container). + // Structure: builds//- + appBuildsDir := filepath.Join(svc.config.DataDir, "builds", app.Name) - err := os.MkdirAll(buildsDir, buildsDirPermissions) + err := os.MkdirAll(appBuildsDir, buildsDirPermissions) if err != nil { svc.failDeployment(ctx, app, deployment, fmt.Errorf("failed to create builds dir: %w", err)) return "", nil, fmt.Errorf("failed to create builds dir: %w", err) } - tempDir, err := os.MkdirTemp(buildsDir, app.ID+"-*") + tempDir, err := os.MkdirTemp(appBuildsDir, fmt.Sprintf("%d-*", deployment.ID)) if err != nil { svc.failDeployment(ctx, app, deployment, fmt.Errorf("failed to create temp dir: %w", err))