@@ -48,6 +48,7 @@ var lintTests = integration.TestFuncs(
4848 testInvalidDefaultArgInFrom ,
4949 testFromPlatformFlagConstDisallowed ,
5050 testCopyIgnoredFiles ,
51+ testCopyIgnoredFileContextRoot ,
5152 testDefinitionDescription ,
5253 testExposeProtoCasing ,
5354 testExposeInvalidFormat ,
@@ -242,6 +243,41 @@ COPY . .
242243 })
243244}
244245
246+ func testCopyIgnoredFileContextRoot (t * testing.T , sb integration.Sandbox ) {
247+ dockerfile := []byte (`
248+ FROM scratch
249+ COPY . .
250+ ` )
251+
252+ t .Run ("dotfiles" , func (t * testing.T ) {
253+ checkLinterWarnings (t , sb , & lintTestParams {
254+ Dockerfile : dockerfile ,
255+ DockerIgnore : []byte (`
256+ .*
257+ ` ),
258+ })
259+ })
260+
261+ t .Run ("wildcard" , func (t * testing.T ) {
262+ checkLinterWarnings (t , sb , & lintTestParams {
263+ Dockerfile : dockerfile ,
264+ DockerIgnore : []byte (`
265+ *
266+ ` ),
267+ Warnings : []expectedLintWarning {
268+ {
269+ RuleName : "CopyIgnoredFile" ,
270+ Description : "Attempting to Copy file that is excluded by .dockerignore" ,
271+ Detail : `Attempting to Copy file "." that is excluded by .dockerignore` ,
272+ URL : "https://docs.docker.com/go/dockerfile/rule/copy-ignored-file/" ,
273+ Level : 1 ,
274+ Line : 3 ,
275+ },
276+ },
277+ })
278+ })
279+ }
280+
245281func testSecretsUsedInArgOrEnv (t * testing.T , sb integration.Sandbox ) {
246282 dockerfile := []byte (`# check=skip=InvalidDefinitionDescription
247283
0 commit comments