1+ # Licensed to Muhammad Hamadto
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ # http://www.apache.org/licenses/LICENSE-2.0
7+ #
8+ # See the NOTICE file distributed with this work for additional information regarding copyright ownership.
9+ #
10+ # Unless required by applicable law or agreed to in writing, software
11+ # distributed under the License is distributed on an "AS IS" BASIS,
12+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ # See the License for the specific language governing permissions and
14+ # limitations under the License.
15+
116version : ' 3.9'
217services :
318 spring-native-aws-lambda-function :
4- image : ghcr.io/muhamadto/spring-native-amazonlinux2-builder:20-amazonlinux2
19+ image : ghcr.io/muhamadto/spring-native-amazonlinux2-builder:20-amazonlinux2-awscliv2
520 ports :
6- - 8080:8080
7- networks :
8- default :
9- aliases :
10- - spring-native-aws-lambda-function
21+ - " 8080:8080"
22+ - " 5005:5005"
1123 volumes :
12- - ./:/opt/build
13- - ${M2_REPO}:/home/ci/.m2
14- working_dir : /opt/build
24+ - ./:/app
25+ - ${M2_REPO}:/home/worker/.m2
26+ working_dir : /app
27+ user : worker
1528 environment :
1629 SPRING_MAIN_WEBAPPLICATIONTYPE : servlet
17- SPRING_PROFILES_ACTIVE : compose
18- AWS_HOST : localstack
19- AWS_ACCESS_KEY_ID : local
20- AWS_SECRET_ACCESS_KEY : local
2130 AWS_DEFAULT_REGION : ap-southeast-2
2231 AWS_REGION : ap-southeast-2
32+ AWS_ACCESS_KEY_ID : local
33+ AWS_SECRET_ACCESS_KEY : local
2334 MAVEN_OPTS : |
2435 -DskipTests=true
2536 -Dcheckstyle.skip=true
@@ -28,39 +39,48 @@ services:
2839 -Dskip.it=true
2940 -Dmaven.javadoc.skip=true
3041 -Dmaven.source.skip=true
31- -Dspring-boot.run.profiles=compose
42+ -Dspring-boot.run.profiles=local
3243 entrypoint :
3344 - bash
3445 - -c
35- command : >
36- "
37- ./mvnw -pl spring-native-aws-lambda-function clean package -Pnative -DskipTests --settings ./settings-spring.xml &&
38- spring-native-aws-lambda-function/target/spring-native-aws-lambda-function
39- "
46+ command : |
47+ '
48+ aws --version &&
49+
50+ source /usr/local/bin/awscliv2-util/aws &&
51+
52+ print_info_message "block" "Creating 'spring-native-aws-lambda-function'" &&
53+
54+ print_info_message "divider" "Package GraalVM function" &&
55+
56+ ./mvnw -ntp clean package -U -Pnative -pl spring-native-aws-lambda-function --settings ./settings-spring.xml &&
57+
58+ lambda_create_function lambda-FUNCTION provided.al2 512 ./spring-native-aws-lambda-function/target/spring-native-aws-lambda-function-native-zip.zip spring-native-aws-lambda-function &&
59+ lambda_wait_for_function lambda-FUNCTION &&
60+ lambda_list_functions &&
61+
62+ print_info_message "block" "Successfully creating 'spring-native-aws-lambda-function'" &&
63+
64+ exit 0
65+ '
4066 depends_on :
4167 - localstack
4268
4369 localstack :
70+ container_name : " ${LOCALSTACK_DOCKER_NAME-localstack_main}"
4471 image : localstack/localstack:latest
45- logging :
46- driver : none
4772 ports :
48- - 4576:4576
49- - ${EDGE_PORT-4566}:${EDGE_PORT-4566}
50- - ${PORT_WEB_UI-8088}:${PORT_WEB_UI-8088}
73+ - " 127.0.0.1:4566:4566" # LocalStack Gateway
74+ - " 127.0.0.1:4510-4559:4510-4559" # external services port range
5175 environment :
52- AWS_DEFAULT_REGION : ap-southeast-2
53- AWS_ACCESS_KEY_ID : local
54- AWS_SECRET_ACCESS_KEY : local
55- SERVICES : sns,sqs,lambda, apigateway
56- DEBUG : 1
57- LS_LOG : debug # seems to give more logs than DEBUG: 1
58- DATA_DIR : ${DATA_DIR- }
59- PORT_WEB_UI : ${PORT_WEB_UI-8088}
60- EDGE_PORT : ${EDGE_PORT-4566}
61- DOCKER_HOST : unix:///var/run/docker.sock
62- HOSTNAME_EXTERNAL : localstack
76+ - DEBUG=${DEBUG-}
77+ - DOCKER_HOST=unix:///var/run/docker.sock
78+ - LOCALSTACK_HOST=localstack
6379 volumes :
64- # If you have access issues on Mac, consider using an alias docker-compose="TMPDIR=/private$TMPDIR /usr/local/bin/docker-compose"
65- - /${TMPDIR:-/tmp/localstack}:/tmp/localstack
66- - /var/run/docker.sock:/var/run/docker.sock
80+ - " ${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
81+ - " /var/run/docker.sock:/var/run/docker.sock"
82+
83+
84+
85+
86+
0 commit comments