Skip to content

Commit

Permalink
Improve the instructions to use Build me example
Browse files Browse the repository at this point in the history
Signed-off-by: cmoulliard <[email protected]>
  • Loading branch information
cmoulliard committed Nov 21, 2024
1 parent 8e783e3 commit acb859c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,28 +218,31 @@ If the build fails for any reason, a `BuildpackException` will be thrown, this i
To play with the Java Buildpack client & DSL, use the following simple java project: [samples/build-me](samples/build-me)
To use it, just configure the following env var pointing to a project to be built as a container image
To use it, configure the following mandatory environment variables pointing to a project (example: [hello-quarkus](samples/hello-quarkus), [hello-spring](samples/hello-spring)) to be built as a container image
```bash
export PROJECT_PATH=<JAVA_PROJECT>
export IMAGE_REF=<IMAGE_REF> // quay.io/<ORG>/<IMAGE_NAME> or <IMAGE_NAME>
export IMAGE_REF=<IMAGE_REF> // <IMAGE_NAME> without registry or <REGISTRY_SERVER>/<REGISTRY_ORG>/<IMAGE_NAME>
```
and execute this command in a terminal:
**Important**: To avoid the `docker rate limit` problem, then set this `CNB_` environment variable to let `lifecycle` to get rid of the limit:
```bash
mvn compile exec:java
export CNB_REGISTRY_AUTH="'{"index.docker.io":"Basic <BASE64_OF_USERNAME:PASSWORD>"}'"
// Replace `<BASE64_OF_USERNAME:PASSWORD> text with
echo -n "username:password" | base64
```
**Important**: To avoid the `docker rate limit` error, set the following env var:
If you plan to push your image to a registry, then set your registry credential using these variables:
```bash
export REGISTRY_USERNAME="<REGISTRY_USERNAME>"
export REGISTRY_PASSWORD="<REGISTRY_PASSWORD>"
export REGISTRY_SERVER="docker.io"
```
and also set this one to let `lifecycle` to get rid of the docker limit:
```bash
export CNB_REGISTRY_AUTH="'{"index.docker.io":"Basic <BASE64_OF_USERNAME:PASSWORD>"}'"
// Replace `<BASE64_OF_USERNAME:PASSWORD> text with
echo -n "username:password" | base64
Execute this command in a terminal:
```bash
mvn compile exec:java
```
### Jbang
Expand Down
22 changes: 12 additions & 10 deletions samples/build-me/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,29 @@
Example of a java project able to build a Quarkus, Spring Boot, ... project
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
To use it, configure the following mandatory environment variables pointing to a project (example: [hello-quarkus](../hello-quarkus), [hello-spring](../hello-spring)) to be built as a container image

```bash
export PROJECT_PATH=<JAVA_PROJECT>
export IMAGE_REF=<IMAGE_REF> // quay.io/<ORG>/<IMAGE_NAME> or <IMAGE_NAME>
export IMAGE_REF=<IMAGE_REF> // <IMAGE_NAME> without registry or <REGISTRY_SERVER>/<REGISTRY_ORG>/<IMAGE_NAME>
```
and execute this command in a terminal:

**Important**: To avoid the `docker rate limit` problem, then set this `CNB_` environment variable to let `lifecycle` to get rid of the limit:
```bash
mvn compile exec:java
export CNB_REGISTRY_AUTH="'{"index.docker.io":"Basic <BASE64_OF_USERNAME:PASSWORD>"}'"

// Replace `<BASE64_OF_USERNAME:PASSWORD> text with
echo -n "username:password" | base64
```

**Important**: To avoid the `docker rate limit` error, set the following env var:
If you plan to push your image to a registry, then set your registry credential using these variables:
```bash
export REGISTRY_USERNAME="<REGISTRY_USERNAME>"
export REGISTRY_PASSWORD="<REGISTRY_PASSWORD>"
export REGISTRY_SERVER="docker.io"
```
and also set this one to let `lifecycle` to get rid of the docker limit:
```bash
export CNB_REGISTRY_AUTH="'{"index.docker.io":"Basic <BASE64_OF_USERNAME:PASSWORD>"}'"

// Replace `<BASE64_OF_USERNAME:PASSWORD> text with
echo -n "username:password" | base64
Execute this command in a terminal:
```bash
mvn compile exec:java
```
1 change: 0 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 @@ -23,7 +23,6 @@ public static void main(String... args) {
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");

Map<String, String> envMap = new HashMap<>();
Expand Down

0 comments on commit acb859c

Please sign in to comment.