diff --git a/Makefile b/Makefile index ad001b6..82102ad 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,13 @@ stack.deploy: cd cdk-stacks && npm install && npm run build cdk deploy --app ./cdk-stacks/bin/app.js --stack PrintStack --parameters uploadBucketName=${BUCKET} +cfn.deploy: build/weasyprint-layer-python$(RUNTIME).zip + @echo "Deploying the weasyprint PDF Layer using SAM" + @sam deploy \ + --resolve-s3 \ + --template-file weasyprintlayer.yaml \ + --stack-name PDFLayer + test.start.container: ${DOCKER_RUN} \ -e GDK_PIXBUF_MODULE_FILE="/opt/lib/loaders.cache" \ diff --git a/weasyprint/Dockerfile b/weasyprint/Dockerfile index fe9a55b..6ab7377 100644 --- a/weasyprint/Dockerfile +++ b/weasyprint/Dockerfile @@ -1,6 +1,6 @@ # Define global args ARG FUNCTION_DIR="/home/app/" -ARG RUNTIME_VERSION="3.11" +ARG RUNTIME_VERSION="3.12" ARG DISTRO_VERSION="3.18" # Stage 1 - bundle base image + runtime diff --git a/weasyprintlayer.yaml b/weasyprintlayer.yaml new file mode 100644 index 0000000..19c8cf3 --- /dev/null +++ b/weasyprintlayer.yaml @@ -0,0 +1,32 @@ +--- +AWSTemplateFormatVersion: "2010-09-09" +Transform: AWS::Serverless-2016-10-31 + +Description: | + The weasyprint (html->pdf) Layer. + +Parameters: + LayerName: + Type: String + Description: The name of the layer. + Default: weasyprintLayer + +Resources: + + PDFLayer: + Type: AWS::Serverless::LayerVersion + Properties: + LayerName: !Ref LayerName + Description: weasyprint (html->pdf) layer. + ContentUri: build/weasyprint-layer-python3.12.zip + CompatibleRuntimes: + - python3.12 + CompatibleArchitectures: + - x86_64 + +Outputs: + + LayerVersionArn: + Value: !GetAtt PDFLayer.LayerVersionArn + Export: + Name: weasyprintLayerArn \ No newline at end of file