Skip to content

Commit a61a655

Browse files
native build_spec.yaml fixed
1 parent 90d513b commit a61a655

File tree

1 file changed

+20
-27
lines changed
  • app-dev/devops-and-containers/devops/oci-devops-terraform-function-java-graalvm/files/build_pipeline_specs

1 file changed

+20
-27
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
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-
9-
FROM container-registry.oracle.com/graalvm/native-image:23-ol8 AS native
10-
WORKDIR /app
11-
COPY --from=build-stage /function/target .
12-
ADD reflection.json .
13-
14-
RUN native-image \
15-
-H:ReflectionConfigurationFiles=/app/reflection.json \
16-
-Ob \
17-
-H:Name=Hello \
18-
-cp "/app/Hellofunc-1.0-SNAPSHOT.jar:/app/*" \
19-
com.fnproject.fn.runtime.EntryPoint
20-
21-
FROM fnproject/fn-java-fdk:jre17-latest as fdk
22-
23-
FROM container-registry.oracle.com/os/oraclelinux:8-slim
24-
COPY --from=native /app/Hello .
25-
COPY --from=fdk /function/runtime/* ./
26-
ENTRYPOINT [ "./Hello" ]
27-
CMD [ "com.example.fn.HelloFunction::handleRequest", "-Djava.library.path=/lib"]
1+
version: 0.1
2+
component: build
3+
timeoutInSeconds: 5000
4+
shell: bash
5+
env:
6+
exportedVariables:
7+
- buildId
8+
steps:
9+
- type: Command
10+
command: |
11+
buildId=`echo ${OCI_BUILD_RUN_ID} | rev | cut -c 1-6 | rev`
12+
echo "Build ID: $buildId"
13+
- type: Command
14+
command: |
15+
docker build -f Dockerfile.native -t ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME} .
16+
docker tag ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:latest ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:$buildId
17+
outputArtifacts:
18+
- name: image-native
19+
type: DOCKER_IMAGE
20+
location: ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}

0 commit comments

Comments
 (0)