Package io.fabric8.maven.docker.util
Class DockerFileUtil
- java.lang.Object
-
- io.fabric8.maven.docker.util.DockerFileUtil
-
public class DockerFileUtil extends Object
Utility class for dealing with dockerfiles- Since:
- 21/01/16
- Author:
- roland
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.codehaus.plexus.interpolation.fixed.FixedStringSearchInterpolatorcreateInterpolator(MojoParameters params, String filter)Create an interpolator for the given maven parameters and filter configuration.static Map<String,String>extractArgs(File dockerfile, Map<String,String> argsFromBuildConfig, org.codehaus.plexus.interpolation.fixed.FixedStringSearchInterpolator interpolator)Extract Args from dockerfile.static List<String>extractBaseImages(File dockerFile, org.codehaus.plexus.interpolation.fixed.FixedStringSearchInterpolator interpolator, Map<String,String> argsFromBuildConfig)Extract the base images from a dockerfile.static String[]extractDelimiters(String filter)static List<String[]>extractLines(File dockerFile, String keyword, org.codehaus.plexus.interpolation.fixed.FixedStringSearchInterpolator interpolator)Extract all lines containing the given keywordstatic Stringinterpolate(File dockerFile, org.codehaus.plexus.interpolation.fixed.FixedStringSearchInterpolator interpolator)Interpolate a docker file with the given properties and filterstatic com.google.gson.JsonObjectreadDockerConfig()static Map<String,?>readKubeConfig()
-
-
-
Method Detail
-
extractBaseImages
public static List<String> extractBaseImages(File dockerFile, org.codehaus.plexus.interpolation.fixed.FixedStringSearchInterpolator interpolator, Map<String,String> argsFromBuildConfig) throws IOException
Extract the base images from a dockerfile. All lines containing aFROMis taken.- Parameters:
dockerFile- file from where to extract the base imageinterpolator- interpolator for replacing properties- Returns:
- LinkedList of base images name or empty collection if none is found.
- Throws:
IOException
-
extractArgs
public static Map<String,String> extractArgs(File dockerfile, Map<String,String> argsFromBuildConfig, org.codehaus.plexus.interpolation.fixed.FixedStringSearchInterpolator interpolator) throws IOException
Extract Args from dockerfile. All lines containing ARG is taken.- Parameters:
dockerfile- Docker Fileinterpolator- interpolator for replacement- Returns:
- HashMap of arguments or empty collection if none is found
- Throws:
IOException
-
extractLines
public static List<String[]> extractLines(File dockerFile, String keyword, org.codehaus.plexus.interpolation.fixed.FixedStringSearchInterpolator interpolator) throws IOException
Extract all lines containing the given keyword- Parameters:
dockerFile- dockerfile to examinekeyword- keyword to extract the lines forinterpolator- interpolator for replacing properties- Returns:
- list of matched lines or an empty list
- Throws:
IOException
-
interpolate
public static String interpolate(File dockerFile, org.codehaus.plexus.interpolation.fixed.FixedStringSearchInterpolator interpolator) throws IOException
Interpolate a docker file with the given properties and filter- Parameters:
dockerFile- docker file to interpolateinterpolator- interpolator for replacing properties- Returns:
- The interpolated contents of the file.
- Throws:
IOException
-
createInterpolator
public static org.codehaus.plexus.interpolation.fixed.FixedStringSearchInterpolator createInterpolator(MojoParameters params, String filter)
Create an interpolator for the given maven parameters and filter configuration.- Parameters:
params- The maven parameters.filter- The filter configuration.- Returns:
- An interpolator for replacing maven properties.
-
readDockerConfig
public static com.google.gson.JsonObject readDockerConfig()
-
-