diff --git a/samples/springboot3/pet-store-native/Dockerfile b/samples/springboot3/pet-store-native/Dockerfile index d885d9261..8c3955861 100644 --- a/samples/springboot3/pet-store-native/Dockerfile +++ b/samples/springboot3/pet-store-native/Dockerfile @@ -25,7 +25,7 @@ RUN ln -s /usr/lib/maven/bin/mvn /usr/bin/mvn ENV GRADLE_VERSION 7.4.1 ENV GRADLE_FOLDERNAME gradle-${GRADLE_VERSION} ENV GRADLE_FILENAME gradle-${GRADLE_VERSION}-bin.zip -RUN curl -LO https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip +RUN curl -LO https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip RUN unzip gradle-${GRADLE_VERSION}-bin.zip RUN mv $GRADLE_FOLDERNAME /usr/lib/gradle RUN ln -s /usr/lib/gradle/bin/gradle /usr/bin/gradle diff --git a/samples/springboot3/pet-store-native/README.md b/samples/springboot3/pet-store-native/README.md index 831353e5a..c890090f7 100644 --- a/samples/springboot3/pet-store-native/README.md +++ b/samples/springboot3/pet-store-native/README.md @@ -1,7 +1,7 @@ In this sample, you'll build a native GraalVM image for running web workloads in AWS Lambda. -## To build the sample on macOS (Apple silicon arm64) +## To build the sample You first need to build the function, then you will deploy it to AWS Lambda. @@ -10,31 +10,21 @@ You first need to build the function, then you will deploy it to AWS Lambda. Before starting the build, you must clone or download the code in **pet-store-native**. 1. Change into the project directory: `samples/springboot3/pet-store-native` -2. Run the following to build a Docker container image which will be used to create the Lambda function zip file. +2. Run the following to build a Docker container image which will include all the necessary dependencies to build the application ``` - docker build -t "al2-graalvm21:native-web" . + docker build -t al2023-graalvm21:native-web . ``` -3. Start the container +3. Build the application within the previously created build image ``` - docker run -dit -v `pwd`:`pwd` -w `pwd` -v ~/.m2:/root/.m2 al2-graalvm21:native-web + docker run -it -v `pwd`:`pwd` -w `pwd` -v ~/.m2:/root/.m2 al2023-graalvm21:native-web ./mvnw clean -Pnative package -DskipTests ``` -4. In Docker, open the image terminal. - - > Your working directory should default to the project root. Verify by running `ls` to view the files. - -6. From inside the container, build the Lambda function: - ``` - ./mvnw clean -Pnative native:compile -DskipTests - ``` - -After the build finishes, you need to deploy the function. -You can do it manually or you can use SAM (AWS Serverless Application Model) with the included template.yaml file. -If you chose SAM simply execute the following command. +4. After the build finishes, you need to deploy the function: ``` sam deploy --guided ``` - This will deploy your application and will attach an AWS API Gateway -Once the deployment is finished you shouild see the following: + +This will deploy your application and will attach an AWS API Gateway +Once the deployment is finished you should see the following: ``` Key ServerlessWebNativeApi Description URL for application diff --git a/samples/springboot3/pet-store-native/pom.xml b/samples/springboot3/pet-store-native/pom.xml index 2348fb8d8..045c8eb96 100644 --- a/samples/springboot3/pet-store-native/pom.xml +++ b/samples/springboot3/pet-store-native/pom.xml @@ -69,8 +69,6 @@ -agentlib:native-image-agent=config-merge-dir=src/main/resources/META-INF/native-image/ --enable-preview - --enable-preview - diff --git a/samples/springboot3/pet-store-native/template.yaml b/samples/springboot3/pet-store-native/template.yaml index e081c7710..dc05e1be7 100644 --- a/samples/springboot3/pet-store-native/template.yaml +++ b/samples/springboot3/pet-store-native/template.yaml @@ -11,8 +11,9 @@ Resources: CodeUri: ./target/pet-store-native-0.0.1-SNAPSHOT-native-zip.zip Handler: NOP Runtime: provided.al2023 - Architectures: - - arm64 +# If you want to build for ARM64 uncomment the following lines +# Architectures: +# - arm64 Events: HttpApiEvent: Type: HttpApi