1- PLATFORM ?= linux/amd64
21RUNTIME ?= 3.12
2+ ARCH ?= x86_64
33TEST_FILENAME ?= report.pdf
44DOCKER_RUN =docker run --rm --platform=${PLATFORM} -e RUNTIME_VERSION=${RUNTIME}
55
6+ ifeq ($(ARCH ) , arm64)
7+ PLATFORM =linux/arm64
8+ else
9+ PLATFORM =linux/amd64
10+ endif
11+
612.PHONY : stack.deploy.weasyprint clean test.start.container test.print.report
713
8- all : build/weasyprint-layer-python$(RUNTIME ) .zip
14+ all : build/weasyprint-layer-python$(RUNTIME ) - $( ARCH ) .zip
915
10- build/weasyprint-layer-python$(RUNTIME ) .zip : weasyprint/layer_builder.sh \
16+ build/weasyprint-layer-python$(RUNTIME ) - $( ARCH ) .zip : weasyprint/layer_builder.sh \
1117 build/fonts-layer.zip \
1218 | _build
1319 ${DOCKER_RUN} \
1420 -v `pwd`/weasyprint:/out \
1521 --entrypoint "/out/layer_builder.sh" \
1622 -t public.ecr.aws/lambda/python:${RUNTIME}
17- mv -f ./weasyprint/layer.zip ./build/weasyprint-layer-python${RUNTIME}-no-fonts.zip
23+ mv -f ./weasyprint/layer.zip ./build/weasyprint-layer-python${RUNTIME}-${ARCH}- no-fonts.zip
1824 cd build && rm -rf ./opt && mkdir opt \
1925 && unzip fonts-layer.zip -d opt \
20- && unzip weasyprint-layer-python${RUNTIME}-no-fonts.zip -d opt \
21- && cd opt && zip -r9 ../weasyprint-layer-python${RUNTIME}.zip .
26+ && unzip weasyprint-layer-python${RUNTIME}-${ARCH}- no-fonts.zip -d opt \
27+ && cd opt && zip -r9 ../weasyprint-layer-python${RUNTIME}-${ARCH} .zip .
2228
2329build/fonts-layer.zip : fonts/layer_builder.sh | _build
2430 ${DOCKER_RUN} \
@@ -42,11 +48,10 @@ stack.deploy:
4248 cd cdk-stacks && npm install && npm run build
4349 cdk deploy --app ./cdk-stacks/bin/app.js --stack PrintStack --parameters uploadBucketName=${BUCKET}
4450
45- test.start.container : build/weasyprint-layer-python$(RUNTIME ) .zip
51+ test.start.container : build/weasyprint-layer-python$(RUNTIME ) - $( ARCH ) .zip
4652 ${DOCKER_RUN} \
47- -e GDK_PIXBUF_MODULE_FILE=" /opt/lib/loaders.cache" \
4853 -e FONTCONFIG_PATH=" /opt/fonts" \
49- -e XDG_DATA_DIRS =" /opt/lib" \
54+ -e LD_LIBRARY_PATH =" /opt/lib" \
5055 -v ` pwd` /weasyprint:/var/task \
5156 -v ` pwd` /build/opt:/opt \
5257 -p 9000:8080 \
0 commit comments