File tree Expand file tree Collapse file tree 3 files changed +25
-40
lines changed
Expand file tree Collapse file tree 3 files changed +25
-40
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ public function runDockerComposeCommand(string $command): bool
108108 public function resetFilesOwner (): bool
109109 {
110110 return $ this ->runDockerComposeCommand (
111- 'run build bash -c "chown -R $(id -u):$(id -g) . /composer/cache" '
111+ 'run --user root build bash -c "uid=$(stat -c %u . 2>/dev/null || stat -f %u .); gid=$(stat -c %g . 2>/dev/null || stat -f %g .); chown -R $uid:$gid . /composer/cache" '
112112 );
113113 }
114114
Original file line number Diff line number Diff line change @@ -77,27 +77,19 @@ public function destination(string $destination): self
7777 /**
7878 * @inheritdoc
7979 */
80- public function getCommand (): string
81- {
82- // Log the values before using them
83- error_log ('Container for cp: ' . $ this ->container );
84- error_log ('Source: ' . $ this ->source );
85- error_log ('Destination: ' . $ this ->destination );
86- $ check_ps_command = sprintf ('docker-compose ps -q %s ' , $ this ->container );
87- error_log ('ps command: ' . $ check_ps_command );
88- return sprintf (
89- '(docker cp %s:%s %s) || (docker-compose cp %s:%s %s) ' ,
90- $ check_ps_command ,
91- $ this ->source ,
92- $ this ->destination ,
93- $ this ->container ,
94- $ this ->source ,
95- $ this ->destination
96- );
97-
98-
99-
100- }
80+ public function getCommand (): string
81+ {
82+ return sprintf (
83+ '(docker-compose cp %s:%s %s) || (docker cp $(docker-compose ps -q %s):%s %s) ' ,
84+ $ this ->container ,
85+ $ this ->source ,
86+ $ this ->destination ,
87+ $ this ->container ,
88+ $ this ->source ,
89+ $ this ->destination
90+ );
91+ }
92+
10193 /**
10294 * @inheritdoc
10395 */
Original file line number Diff line number Diff line change @@ -78,24 +78,17 @@ public function destination(string $destination): self
7878 * @inheritdoc
7979 */
8080 public function getCommand (): string
81- {
82- // Log the values before using them
83- error_log ('Container for cp: ' . $ this ->container );
84- error_log ('Source: ' . $ this ->source );
85- error_log ('Destination: ' . $ this ->destination );
86- $ check_ps_command = sprintf ('docker-compose ps -q %s ' , $ this ->container );
87- error_log ('ps command: ' . $ check_ps_command );
88- return sprintf (
89- '(docker cp %s:%s %s) || (docker-compose cp %s:%s %s) ' ,
90- $ check_ps_command ,
91- $ this ->source ,
92- $ this ->destination ,
93- $ this ->container ,
94- $ this ->source ,
95- $ this ->destination
96- );
97-
98- }
81+ {
82+ return sprintf (
83+ '(docker cp %s %s:%s) || (docker-compose cp %s %s:%s) ' ,
84+ $ this ->source ,
85+ $ this ->container ,
86+ $ this ->destination ,
87+ $ this ->source ,
88+ $ this ->container ,
89+ $ this ->destination
90+ );
91+ }
9992
10093 /**
10194 * @inheritdoc
You can’t perform that action at this time.
0 commit comments