Skip to content

Commit

Permalink
Additional examples fixes + archetype fix
Browse files Browse the repository at this point in the history
Signed-off-by: tvallin <thibault.vallin@oracle.com>
  • Loading branch information
tvallin committed Oct 31, 2023
1 parent a90a57c commit 07b43ad
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 35 deletions.
6 changes: 3 additions & 3 deletions archetypes/helidon/src/main/archetype/common/docker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
</includes>
</templates>
<model>
<list key="poms">
<value>pom.xml</value>
<list key="poms" if="!${multi-module}">
<value>pom.xml .</value>
</list>
<list key="src-dirs" if="!${multi-module}">
<value>src</value>
<value>src src</value>
</list>
<list key="native-sections" if="${docker.native-image}">
<value file="files/README.native.md"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@

# 1st stage, build the app
FROM maven:3.8.4-openjdk-17-slim as build
FROM ghcr.io/graalvm/graalvm-community:21.0.0-ol9 as build

WORKDIR /usr/share

# Install maven
RUN set -x && \
curl -O https://archive.apache.org/dist/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz && \
tar -xvf apache-maven-*-bin.tar.gz && \
rm apache-maven-*-bin.tar.gz && \
mv apache-maven-* maven && \
ln -s /usr/share/maven/bin/mvn /bin/

WORKDIR /helidon

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
{{#poms}}
ADD {{.}} {{.}}
ADD {{.}}
{{/poms}}
RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip {{#docker-phase1-options}}{{.}}{{^last}} {{/last}}{{/docker-phase1-options}}

# Do the Maven build!
# Incremental docker builds will resume here when you change sources
{{#src-dirs}}
ADD {{.}} {{.}}
ADD {{.}}
{{/src-dirs}}
RUN mvn package -DskipTests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -Pnative-image -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip
RUN mvn package -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip

# Do the Maven build!
# Incremental docker builds will resume here when you change sources
ADD src src
RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests
RUN mvn package -Pnative-image -DbuildArgs=--static -DskipTests

RUN echo "done!"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<artifactId>{{artifactId}}</artifactId>
<version>{{project-version}}</version>

<properties>
{{#mainClass}}
<properties>
<mainClass>{{mainClass}}</mainClass>
{{/mainClass}}
</properties>
{{/mainClass}}

<dependencies>
{{#dependencies}}
Expand Down
11 changes: 6 additions & 5 deletions archetypes/helidon/src/main/archetype/mp/oci/oci-mp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,14 @@ Mount this volume as part of your application containers specification
]]></value>
</list>
<list key="poms">
<value>client/pom.xml</value>
<value>server/pom.xml</value>
<value>pom.xml pom.xml</value>
<value>client/pom.xml client/pom.xml</value>
<value>server/pom.xml server/pom.xml</value>
</list>
<list key="src-dirs">
<value>client/src</value>
<value>server/src</value>
<value>spec/api.yaml</value>
<value>client/src client/src</value>
<value>server/src server/src</value>
<value>spec/api.yaml spec/api.yaml</value>
</list>
</model>
</output>
Expand Down
4 changes: 2 additions & 2 deletions examples/quickstarts/helidon-quickstart-mp/Dockerfile.native
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -Pnative-image -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip
RUN mvn package -Pnative-image -DskipNativeBuild -Dmaven.test.skip -Declipselink.weave.skip

# Do the Maven build!
# Incremental docker builds will resume here when you change sources
ADD src src
RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests
RUN mvn package -Pnative-image -DbuildArgs=--static -DskipTests

RUN echo "done!"

Expand Down
4 changes: 2 additions & 2 deletions examples/quickstarts/helidon-quickstart-se/Dockerfile.native
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn clean package -Pnative-image -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip
RUN mvn package -DskipNativeBuild -Dmaven.test.skip -Declipselink.weave.skip

# Do the Maven build!
# Incremental docker builds will resume here when you change sources
ADD src src
RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests
RUN mvn package -Pnative-image -DbuildArgs=--static -DskipTests

RUN echo "done!"

Expand Down
1 change: 0 additions & 1 deletion examples/quickstarts/helidon-quickstart-se/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
</parent>
<groupId>io.helidon.examples</groupId>
<artifactId>helidon-quickstart-se</artifactId>
<version>4.0.0-SNAPSHOT</version>
<name>Helidon Examples Quickstart SE</name>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ RUN echo "done!"

FROM debian:stretch-slim
WORKDIR /helidon
COPY --from=build /helidon/target/helidon-quickstart-mp-jri ./
COPY --from=build /helidon/target/helidon-standalone-quickstart-mp-jri ./
ENTRYPOINT ["/bin/bash", "/helidon/bin/start"]
EXPOSE 8080
12 changes: 6 additions & 6 deletions examples/quickstarts/helidon-standalone-quickstart-mp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ Start the application:
Build the "native" Docker Image

```
docker build -t helidon-quickstart-mp-native -f Dockerfile.native .
docker build -t helidon-standalone-quickstart-mp-native -f Dockerfile.native .
```

Start the application:

```
docker run --rm -p 8080:8080 helidon-quickstart-mp-native:latest
docker run --rm -p 8080:8080 helidon-standalone-quickstart-mp-native:latest
```

## Build a Java Runtime Image using jlink
Expand Down Expand Up @@ -141,25 +141,25 @@ See https://github.com/oracle/helidon-build-tools/tree/master/helidon-maven-plug
Start the application:

```
./target/helidon-quickstart-se-jri/bin/start
./target/helidon-standalone-quickstart-mp-jri/bin/start
```

### Multi-stage Docker build

Build the JRI as a Docker Image

```
docker build -t helidon-quickstart-mp-jri -f Dockerfile.jlink .
docker build -t helidon-standalone-quickstart-mp-jri -f Dockerfile.jlink .
```

Start the application:

```
docker run --rm -p 8080:8080 helidon-quickstart-mp-jri:latest
docker run --rm -p 8080:8080 helidon-standalone-quickstart-mp-jri:latest
```

See the start script help:

```
docker run --rm helidon-quickstart-mp-jri:latest --help
docker run --rm helidon-standalone-quickstart-mp-jri:latest --help
```
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ RUN echo "done!"

FROM debian:stretch-slim
WORKDIR /helidon
COPY --from=build /helidon/target/helidon-quickstart-se-jri ./
COPY --from=build /helidon/target/helidon-standalone-quickstart-se-jri ./
ENTRYPOINT ["/bin/bash", "/helidon/bin/start"]
EXPOSE 8080
Original file line number Diff line number Diff line change
Expand Up @@ -142,25 +142,25 @@ See https://github.com/oracle/helidon-build-tools/tree/master/helidon-maven-plug
Start the application:

```
./target/helidon-quickstart-se-jri/bin/start
./target/helidon-standalone-quickstart-se-jri/bin/start
```

### Multi-stage Docker build

Build the JRI as a Docker Image

```
docker build -t helidon-quickstart-se-jri -f Dockerfile.jlink .
docker build -t helidon-standalone-quickstart-se-jri -f Dockerfile.jlink .
```

Start the application:

```
docker run --rm -p 8080:8080 helidon-quickstart-se-jri:latest
docker run --rm -p 8080:8080 helidon-standalone-quickstart-se-jri:latest
```

See the start script help:

```
docker run --rm helidon-quickstart-se-jri:latest --help
docker run --rm helidon-standalone-quickstart-se-jri:latest --help
```
2 changes: 1 addition & 1 deletion examples/translator-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ kubectl apply \
With Docker:
```bash
docker build -t helidon-examples-translator-backend backend/
docker build -t helidon-examples--translator-frontend frontend/
docker build -t helidon-examples-translator-frontend frontend/
docker run --rm -d -p 9080:9080 \
--link zipkin \
--name helidon-examples-translator-backend \
Expand Down
1 change: 0 additions & 1 deletion examples/translator-app/backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
</parent>
<groupId>io.helidon.examples.translator</groupId>
<artifactId>helidon-examples-translator-backend</artifactId>
<version>4.0.0-SNAPSHOT</version>
<name>Helidon Examples Translator Backend</name>

<description>
Expand Down
1 change: 0 additions & 1 deletion examples/translator-app/frontend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
</parent>
<groupId>io.helidon.examples.translator</groupId>
<artifactId>helidon-examples-translator-frontend</artifactId>
<version>4.0.0-SNAPSHOT</version>
<name>Helidon Examples Translator Frontend</name>

<description>
Expand Down

0 comments on commit 07b43ad

Please sign in to comment.