Skip to content

Commit 5f9d768

Browse files
committed
fix: copy over .dockerignore when doing image deployment
fixes #19
1 parent d282347 commit 5f9d768

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/Build/CopyWordPressFilesStep.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ public function perform(string $environment, ProjectConfiguration $projectConfig
7474
$environment = $projectConfiguration->getEnvironment($environment);
7575
$files = $this->getProjectFiles($projectConfiguration->getProjectType());
7676

77+
if ('image' === Arr::get($environment, 'deployment')) {
78+
$files->append([$this->getSplFileInfo('/.dockerignore')]);
79+
}
80+
7781
if (Arr::has($environment, 'build.include')) {
7882
$files->append($this->getIncludedFiles(Arr::get($environment, 'build.include')));
7983
}
@@ -130,7 +134,9 @@ private function getProjectFiles(string $projectType): Finder
130134

131135
if ('wordpress' === $projectType) {
132136
$finder->exclude('wp-content/uploads');
133-
$finder->append($this->getWordPressFilesToAppend());
137+
138+
// wp-config.php is often in .gitignore, so we need to add it back
139+
$finder->append([$this->getSplFileInfo('/wp-config.php')]);
134140
} elseif ('bedrock' === $projectType) {
135141
$finder->exclude('web/app/uploads');
136142
}
@@ -139,11 +145,10 @@ private function getProjectFiles(string $projectType): Finder
139145
}
140146

141147
/**
142-
* List of WordPress files we need to append manually.
148+
* Get a SplFileInfo object for a project file.
143149
*/
144-
private function getWordPressFilesToAppend(): array
150+
private function getSplFileInfo(string $path): SplFileInfo
145151
{
146-
// wp-config.php is often in .gitignore so we need to add it back
147-
return [new SplFileInfo($this->projectDirectory.'/wp-config.php', $this->projectDirectory, '/wp-config.php')];
152+
return new SplFileInfo($this->projectDirectory.$path, $this->projectDirectory, $path);
148153
}
149154
}

0 commit comments

Comments
 (0)