Skip to content

Commit

Permalink
Externalize using an env var the image reference/name
Browse files Browse the repository at this point in the history
Signed-off-by: cmoulliard <[email protected]>
  • Loading branch information
cmoulliard committed Nov 20, 2024
1 parent dfe08b5 commit f1591d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion samples/build-me/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ using the DSL `BuildConfig.builder()`
To use it, just configure the following env var pointing to a project to be built as a container image

```bash
exort PROJECT_PATH=<JAVA_PROJECT>
export PROJECT_PATH=<JAVA_PROJECT>
export IMAGE_REF=<IMAGE_REF> // quay.io/<ORG>/<IMAGE_NAME> or <IMAGE_NAME>
```
and execute this command in a terminal:
```bash
Expand Down
3 changes: 2 additions & 1 deletion samples/build-me/src/main/java/dev/snowdrop/BuildMe.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static void main(String... args) {
String REGISTRY_USERNAME = System.getenv("REGISTRY_USERNAME");
String REGISTRY_PASSWORD = System.getenv("REGISTRY_PASSWORD");
String REGISTRY_SERVER = System.getenv("REGISTRY_SERVER");
String IMAGE_REF = System.getenv("IMAGE_REF");

String PROJECT_PATH = System.getenv("PROJECT_PATH");
File filePath = new File(PROJECT_PATH);
Expand All @@ -39,7 +40,7 @@ public static void main(String... args) {

int exitCode = BuildConfig.builder()
.withBuilderImage(new ImageReference("paketocommunity/builder-ubi-base:latest"))
.withOutputImage(new ImageReference("quay.io/snowdrop/my-quarkus-app"))
.withOutputImage(new ImageReference(IMAGE_REF))
.withNewPlatformConfig()
.withEnvironment(envMap)
.endPlatformConfig()
Expand Down

0 comments on commit f1591d5

Please sign in to comment.