Skip to content

Commit 596a1a7

Browse files
authored
added support for adding additional OS packages to AdditionalBuildCommands (#217)
1 parent 692466d commit 596a1a7

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

imagetool/src/main/java/com/oracle/weblogic/imagetool/util/AdditionalBuildCommands.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
public class AdditionalBuildCommands {
2222
private static final LoggingFacade logger = LoggingFactory.getLogger(AdditionalBuildCommands.class);
2323

24+
public static final String PACKAGES = "package-manager-packages";
2425
public static final String BEFORE_JDK = "before-jdk-install";
2526
public static final String AFTER_JDK = "after-jdk-install";
2627
public static final String BEFORE_FMW = "before-fmw-install";
@@ -34,6 +35,7 @@ public class AdditionalBuildCommands {
3435

3536
private AdditionalBuildCommands() {
3637
sections = new ArrayList<>();
38+
sections.add(getPattern(PACKAGES));
3739
sections.add(getPattern(BEFORE_JDK));
3840
sections.add(getPattern(AFTER_JDK));
3941
sections.add(getPattern(BEFORE_FMW));

imagetool/src/main/java/com/oracle/weblogic/imagetool/util/DockerfileOptions.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,16 @@ private List<String> getAdditionalCommandsForSection(String sectionName) {
786786
return additionalBuildCommands.get(sectionName);
787787
}
788788

789+
/**
790+
* Referenced by Dockerfile template, provides additional OS packages supplied by the user.
791+
*
792+
* @return list of commands as Strings.
793+
*/
794+
@SuppressWarnings("unused")
795+
public List<String> osPackages() {
796+
return getAdditionalCommandsForSection(AdditionalBuildCommands.PACKAGES);
797+
}
798+
789799
/**
790800
* Referenced by Dockerfile template, provides additional build commands supplied by the user.
791801
*

imagetool/src/main/resources/ImageTool.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ IMG-0044=Invalid arguments. Both --key and --path are required parameters, and c
4646
IMG-0045=Invalid argument. The value for --key should correspond to a valid entry in the cache.
4747
IMG-0046=Deleted all entries from cache
4848
IMG-0047=cache is empty
49-
IMG-0048=Installer already exists {0}={1}. Try removing it, before adding it again: deleteEntry --key={0}
49+
IMG-0048=Installer already exists {0}={1}. Try removing it, before adding it again: imagetool cache deleteEntry --key={0}
5050
IMG-0049=Could not find value for --path, file not found: {0}
5151
IMG-0050=Successfully added to cache. {0}={1}
5252
IMG-0051=Deleted entry [[cyan: {0}]]={1}

imagetool/src/main/resources/docker-files/Create_Image.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ LABEL com.oracle.weblogic.imagetool.buildid="{{buildId}}"
99
USER root
1010

1111
{{#useYum}}
12-
RUN yum -y --downloaddir={{{tempDir}}} install gzip tar unzip libaio \
12+
RUN yum -y --downloaddir={{{tempDir}}} install gzip tar unzip libaio {{#osPackages}}{{{.}}} {{/osPackages}}\
1313
&& yum -y --downloaddir={{{tempDir}}} clean all \
1414
&& rm -rf /var/cache/yum/* \
1515
&& rm -rf {{{tempDir}}}
1616
{{/useYum}}
1717
{{#useDnf}}
18-
RUN dnf -y install gzip tar unzip libaio \
18+
RUN dnf -y install gzip tar unzip libaio {{#osPackages}}{{{.}}} {{/osPackages}}\
1919
&& dnf clean all
2020
{{/useDnf}}
2121
{{#useMicroDnf}}
22-
RUN microdnf install gzip tar unzip libaio shadow-utils \
22+
RUN microdnf install gzip tar unzip libaio shadow-utils {{#osPackages}}{{{.}}} {{/osPackages}}\
2323
&& microdnf clean all
2424
{{/useMicroDnf}}
2525
{{#useAptGet}}
2626
RUN apt-get -y update \
2727
&& apt-get -y upgrade \
28-
&& apt-get -y install gzip tar unzip libaio \
28+
&& apt-get -y install gzip tar unzip libaio {{#osPackages}}{{{.}}} {{/osPackages}}\
2929
&& apt-get -y clean all
3030
{{/useAptGet}}
3131
{{#useApk}}

0 commit comments

Comments
 (0)