diff --git a/src/main/java/org/openrewrite/docker/trait/Dockerfile.java b/src/main/java/org/openrewrite/docker/trait/Dockerfile.java index 712542d..648b9a9 100644 --- a/src/main/java/org/openrewrite/docker/trait/Dockerfile.java +++ b/src/main/java/org/openrewrite/docker/trait/Dockerfile.java @@ -51,7 +51,8 @@ public static class Matcher extends SimpleTraitMatcher { Object value = cursor.getValue(); if (value instanceof PlainText) { PlainText text = (PlainText) value; - if (text.getSourcePath().toFile().getName().equals("Dockerfile")) { + String fileName = text.getSourcePath().toFile().getName(); + if (fileName.equals("Dockerfile") || fileName.equals("Containerfile")) { return new Dockerfile(cursor); } } diff --git a/src/test/java/org/openrewrite/docker/FindDockerImagesUsedTest.java b/src/test/java/org/openrewrite/docker/FindDockerImagesUsedTest.java index 47cfbb2..4318441 100644 --- a/src/test/java/org/openrewrite/docker/FindDockerImagesUsedTest.java +++ b/src/test/java/org/openrewrite/docker/FindDockerImagesUsedTest.java @@ -16,6 +16,8 @@ package org.openrewrite.docker; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import org.openrewrite.DocumentExample; import org.openrewrite.docker.search.FindDockerImageUses; import org.openrewrite.docker.table.DockerBaseImages; @@ -32,9 +34,10 @@ public void defaults(RecipeSpec spec) { spec.recipe(new FindDockerImageUses()); } - @Test @DocumentExample - void dockerfile() { + @ParameterizedTest + @ValueSource(strings = {"Dockerfile", "Containerfile"}) + void dockerfile(String path) { rewriteRun( text( //language=Dockerfile @@ -50,7 +53,7 @@ void dockerfile() { ARG DEBIAN_FRONTEND=noninteractive SHELL ["sh", "-lc"] """, - spec -> spec.path("Dockerfile") + spec -> spec.path(path) ) ); }