├── .gitattributes ├── .gitignore ├── renovate.json ├── ghostscript.zip ├── .editorconfig ├── .husky ├── pre-push ├── post-commit ├── post-merge └── post-checkout ├── Dockerfile ├── publish.sh ├── license └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.js text eol=lf 3 | *.zip filter=lfs diff=lfs merge=lfs -text 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | coverage/ 3 | node_modules/ 4 | temp 5 | yarn.lock 6 | *.log 7 | .DS_Store 8 | lib/ 9 | layer/ 10 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["config:base"], 3 | "labels": ["dependencies", "backend"], 4 | "ignoreDeps": [ 5 | "@types/node" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /ghostscript.zip: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:327f7666c5fceaea4b1effe709ab6a9470972c3080080b35a9d69e1054fa9c93 3 | size 15592542 4 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | charset = utf-8 6 | trim_trailing_whitespace = true 7 | insert_final_newline = true 8 | indent_style = space 9 | indent_size = 2 10 | -------------------------------------------------------------------------------- /.husky/pre-push: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/pre-push'.\n"; exit 2; } 3 | git lfs pre-push "$@" 4 | -------------------------------------------------------------------------------- /.husky/post-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/post-commit'.\n"; exit 2; } 3 | git lfs post-commit "$@" 4 | -------------------------------------------------------------------------------- /.husky/post-merge: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/post-merge'.\n"; exit 2; } 3 | git lfs post-merge "$@" 4 | -------------------------------------------------------------------------------- /.husky/post-checkout: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/post-checkout'.\n"; exit 2; } 3 | git lfs post-checkout "$@" 4 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM lambci/lambda-base-2:build 2 | ENV GS_TAG=gs10040 3 | ENV GS_VERSION=10.04.0 4 | 5 | RUN yum install -y wget 6 | 7 | RUN mkdir /usr/local/src/ghostscript && \ 8 | cd /usr/local/src/ghostscript && \ 9 | wget -qO - https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/$GS_TAG/ghostscript-$GS_VERSION.tar.gz | tar -zxf - && \ 10 | cd ghostscript-$GS_VERSION && \ 11 | ./configure --without-luratech && \ 12 | make && make install 13 | 14 | RUN cd /usr/local && \ 15 | zip /tmp/gs.zip bin/gs 16 | -------------------------------------------------------------------------------- /publish.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | GHOSTSCRIPT_VERSION=10.04.0 4 | LAYER_NAME='ghostscript' 5 | LAYER_VERSION=$( 6 | aws lambda publish-layer-version --region "$TARGET_REGION" \ 7 | --layer-name $LAYER_NAME \ 8 | --zip-file fileb:///home/circleci/project/ghostscript.zip \ 9 | --description "Ghostscript v${GHOSTSCRIPT_VERSION}" \ 10 | --query Version \ 11 | --output text 12 | ) 13 | 14 | aws lambda add-layer-version-permission \ 15 | --region "$TARGET_REGION" \ 16 | --layer-name $LAYER_NAME \ 17 | --statement-id sid1 \ 18 | --action lambda:GetLayerVersion \ 19 | --principal '*' \ 20 | --query Statement \ 21 | --output text \ 22 | --version-number "$LAYER_VERSION" 23 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Gemshelf Inc. (shelf.io) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ghostscript for AWS Lambda as a Layer 2 | 3 | ## Getting Started 4 | 5 | Click on Layers and choose "Add a layer", and "Provide a layer version ARN" and enter the following ARN. 6 | 7 | ``` 8 | arn:aws:lambda::764866452798:layer:ghostscript: 9 | ``` 10 | 11 | Works with the following [AWS Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html) which 12 | run on Amazon Linux 2: 13 | 14 | - nodejs16.x, nodejs14.x, nodejs12.x, nodejs10.x 15 | - python3.8 16 | - java11 17 | 18 | ## Version Numbers 19 | 20 | | Ghostscript | VERSION | eu-west-3 | 21 | |-------------|---------|-----------| 22 | | v10.04.0 | 17 | 18 | 23 | | v10.02.0 | 15 | 16 | 24 | | v10.0.0 | 13 | 14 | 25 | | v9.56.1 | 12 | 13 | 26 | | v9.55.0 | 9 | 10 | 27 | | v9.52.0 | 8 | 9 | 28 | | v9.50.0 | 6 | 7 | 29 | | v9.20.0 | 1 | 1 | 30 | 31 | ## Where can I find the Ghostscript binary inside of Lambda after I attach the layer? 32 | 33 | You can find it at `/opt/bin/gs` (`/opt` is where Lambda unpacks layers). 34 | 35 | You can run `/opt/bin/gs --version` to make sure Ghostscript is up and running. 36 | 37 | ## Update 38 | 39 | 1. Change version number & git tag in the `Dockerfile` 40 | 2. Run `./build.sh` script which will produce `ghostscript.zip` file 41 | 3. Change version number in the `publish.sh` 42 | 4. Commit & Create a Pull Request 43 | 5. After merging, a new layer version will be published by the CI automatically 44 | 45 | ## License 46 | 47 | MIT © [Shelf](https://shelf.io) 48 | --------------------------------------------------------------------------------