diff --git a/Dockerfile b/Dockerfile index d25d7e8..1dcd95b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,33 @@ -FROM lambci/lambda-base-2:build -ENV GS_TAG=gs10040 -ENV GS_VERSION=10.04.0 +FROM ubuntu:latest -RUN yum install -y wget +ENV DEBIAN_FRONTEND=noninteractive +ENV GS_TAG=gs10051 +ENV GS_VERSION=10.05.1 -RUN mkdir /usr/local/src/ghostscript && \ - cd /usr/local/src/ghostscript && \ - wget -qO - https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/$GS_TAG/ghostscript-$GS_VERSION.tar.gz | tar -zxf - && \ - cd ghostscript-$GS_VERSION && \ - ./configure --without-luratech && \ - make && make install +# Install system build dependencies +RUN apt-get update && apt-get install -y \ + build-essential \ + wget \ + curl \ + zip \ + gcc \ + g++ \ + make \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* -RUN cd /usr/local && \ - zip /tmp/gs.zip bin/gs +# Build and install Ghostscript +RUN mkdir -p /usr/local/src/ghostscript && \ + cd /usr/local/src/ghostscript && \ + wget -q https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/${GS_TAG}/ghostscript-${GS_VERSION}.tar.gz && \ + tar -zxf ghostscript-${GS_VERSION}.tar.gz && \ + cd ghostscript-${GS_VERSION} && \ + ./configure --without-luratech && \ + make -j$(nproc) && \ + make install + +# Package /opt directory as Lambda layer zip +RUN mkdir -p /opt/bin && \ + cp /usr/local/bin/gs /opt/bin/ && \ + cd /opt && \ + zip -r /tmp/ghostscript.zip . \ No newline at end of file diff --git a/README.md b/README.md index dc011a3..067ae82 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ run on Amazon Linux 2: | Ghostscript | VERSION | eu-west-3 | |-------------|---------|-----------| +| v10.05.1 | 18 | 19 | | v10.04.0 | 17 | 18 | | v10.02.0 | 15 | 16 | | v10.0.0 | 13 | 14 | diff --git a/build.sh b/build.sh index 39b4964..13c9b10 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,14 @@ #!/usr/bin/env bash +set -e +echo "Building Docker image..." docker build -t gs-lambda-layer . -docker run --rm gs-lambda-layer cat /tmp/gs.zip > ./ghostscript.zip + +echo "Creating container..." +container_id=$(docker create gs-lambda-layer sleep 1) + +echo "Copying built Lambda layer ZIP to host..." +docker cp "$container_id":/tmp/ghostscript.zip ./ghostscript.zip + +echo "Cleaning up container..." +docker rm "$container_id" \ No newline at end of file diff --git a/ghostscript.zip b/ghostscript.zip index 8d90328..c70aaa0 100644 --- a/ghostscript.zip +++ b/ghostscript.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:327f7666c5fceaea4b1effe709ab6a9470972c3080080b35a9d69e1054fa9c93 -size 15592542 +oid sha256:6b7030e9b168155b26285d18aca75ed3fe817b7e0de1f6e4ae6bef4a62f2147e +size 15995027 diff --git a/publish.sh b/publish.sh index 2e6a83a..8734118 100755 --- a/publish.sh +++ b/publish.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -GHOSTSCRIPT_VERSION=10.04.0 +GHOSTSCRIPT_VERSION=10.05.1 LAYER_NAME='ghostscript' LAYER_VERSION=$( aws lambda publish-layer-version --region "$TARGET_REGION" \