Skip to content

Commit 9c15b85

Browse files
authored
Merge pull request #1594 from oracle-devrel/native-build-fix-2
native build fix
2 parents 014ecd8 + de6eaec commit 9c15b85

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/files/Dockerfile.native

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1+
FROM fnproject/fn-java-fdk-build:jdk17-1.0-latest as build-stage
2+
WORKDIR /function
3+
ENV MAVEN_OPTS -Dhttp.proxyHost= -Dhttp.proxyPort= -Dhttps.proxyHost= -Dhttps.proxyPort= -Dhttp.nonProxyHosts= -Dmaven.repo.local=/usr/share/maven/ref/repository
4+
ADD pom.xml /function/pom.xml
5+
RUN ["mvn", "package", "dependency:copy-dependencies", "-DincludeScope=runtime", "-DskipTests=true", "-Dmdep.prependGroupId=true", "-DoutputDirectory=target", "--fail-never"]
6+
ADD src /function/src
7+
RUN ["mvn", "package"]
8+
19
FROM container-registry.oracle.com/graalvm/native-image:23-ol8 AS native
210
WORKDIR /app
3-
4-
COPY target .
11+
COPY --from=build-stage /function/target .
512
ADD reflection.json .
613

714
RUN native-image \
815
-H:ReflectionConfigurationFiles=/app/reflection.json \
916
-Ob \
1017
-H:Name=Hello \
11-
-cp "/app/Hellofunc-1.0-SNAPSHOT.jar:/app/lib/*" \
18+
-cp "/app/Hellofunc-1.0-SNAPSHOT.jar:/app/*" \
1219
com.fnproject.fn.runtime.EntryPoint
1320

1421
FROM fnproject/fn-java-fdk:jre17-1.0.198 as fdk

app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/files/build_spec_native.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ steps:
1212
echo "Build ID: $buildId"
1313
- type: Command
1414
command: |
15-
# This replaces the default open-jdk
16-
export GRAALVM_VERSION="21"
17-
export JAVA_VERSION="17"
18-
yum -y install graalvm${GRAALVM_VERSION}-ee-${JAVA_VERSION}-jdk;
19-
export JAVA_HOME=/usr/lib64/graalvm/graalvm${GRAALVM_VERSION}-ee-java${JAVA_VERSION};
20-
java -version
21-
22-
mvn clean install
23-
2415
docker build -f Dockerfile.native -t ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME} .
2516
docker tag ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:latest ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:$buildId
2617
outputArtifacts:

0 commit comments

Comments
 (0)