File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,21 @@ set -e
1515LAYER_DIR=" .layers"
1616LAYER_FILES_PREFIX=" datadog_lambda_py"
1717AVAILABLE_PYTHON_VERSIONS=(" 3.8" " 3.9" " 3.10" " 3.11" " 3.12" )
18+ AVAILABLE_ARCHS=(" arm64" " amd64" )
19+
20+ if [ -z " $ARCH " ]; then
21+ echo " No architectures specified, building layers for all architectures."
22+ ARCHS=(" ${AVAILABLE_ARCHS[@]} " )
23+ else
24+ echo " Architecture specified: $ARCH "
25+ if [[ ! " ${AVAILABLE_ARCHS[@]} " =~ " ${ARCH} " ]]; then
26+ echo " Architecture $ARCH is not a valid option. Choose from: ${AVAILABLE_ARCHS[@]} "
27+ echo " "
28+ echo " EXITING SCRIPT."
29+ exit 1
30+ fi
31+ ARCHS=$ARCH
32+ fi
1833
1934# Determine which Python versions to build layers for
2035if [ -z " $PYTHON_VERSION " ]; then
@@ -64,10 +79,11 @@ mkdir $LAYER_DIR
6479
6580for python_version in " ${PYTHON_VERSIONS[@]} "
6681do
67- echo " Building layer for Python ${python_version} arch=arm64"
68- docker_build_zip ${python_version} $LAYER_DIR /${LAYER_FILES_PREFIX} -arm64-${python_version} .zip arm64
69- echo " Building layer for Python ${python_version} arch=amd64"
70- docker_build_zip ${python_version} $LAYER_DIR /${LAYER_FILES_PREFIX} -amd64-${python_version} .zip amd64
82+ for architecture in " ${ARCHS[@]} "
83+ do
84+ echo " Building layer for Python ${python_version} arch=${architecture} "
85+ docker_build_zip ${python_version} $LAYER_DIR /${LAYER_FILES_PREFIX} -${architecture} -${python_version} .zip ${architecture}
86+ done
7187done
7288
7389echo " Done creating layers:"
You can’t perform that action at this time.
0 commit comments