Add a Dockerfile
to the directory with the jar file:
Dockerfile
# syntax=docker/dockerfile:1
FROM eclipse-temurin:17-jdk-jammy
WORKDIR /app
COPY *.jar app.jar
CMD ["java", "-jar", "app.jar"]
Then, build and push the image:
docker build . --tag $DOCKER_ID/jarapp:amd64
docker push $DOCKER_ID/jarapp:amd64
Finally, deploy to TAP:
tanzu apps workload create jar-app \
--type server \
--label app.kubernetes.io/part-of=jar-app \
--image $DOCKER_ID/jarapp:amd64
Once it is up and running, port-forward to the service:
kubectl port-forward service/jar-app 8080:8080
And, then curl the end point:
% curl localhost:8080
Greetings from Spring Boot + Tanzu!
If you prefer a Knative service then use this to deploy:
tanzu apps workload create jar-app-ksvc \
--type web \
--label app.kubernetes.io/part-of=jar-app-ksvc \
--annotation autoscaling.knative.dev/min-scale=1 \
--image $DOCKER_ID/jarapp:amd64