-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #961 from vdice/fix/dockerignore
fix(docker.go): read .dockerignore file for appropriate build exclusions
- Loading branch information
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// +build integration | ||
|
||
package tests | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"get.porter.sh/porter/pkg/porter" | ||
) | ||
|
||
func TestBuild_withDockerignore(t *testing.T) { | ||
p := porter.NewTestPorter(t) | ||
p.SetupIntegrationTest() | ||
defer p.CleanupIntegrationTest() | ||
p.Debug = false | ||
|
||
p.TestConfig.TestContext.AddTestDirectory(filepath.Join(p.TestDir, "testdata/bundles/outputs-example"), ".") | ||
|
||
// Create .dockerignore file which ignores the Dockerfile | ||
err := p.FileSystem.WriteFile(".dockerignore", []byte("Dockerfile"), 0644) | ||
require.NoError(t, err) | ||
|
||
// Verify Porter uses the .dockerignore file | ||
opts := porter.BuildOptions{} | ||
err = p.Build(opts) | ||
require.EqualError(t, err, "unable to build CNAB invocation image: Error response from daemon: Cannot locate specified Dockerfile: Dockerfile") | ||
} |