Skip to content

Add Ghostscript & Support for AWS Linux 2 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.zip
layer
layer
.DS_Store
32 changes: 25 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
FROM lambci/lambda-base:build
FROM amazonlinux:2

RUN target=/etc/yum.repos.d/linuxtech.repo && echo [linuxtech] > $target \
&& echo name=LinuxTECH >> $target \
&& echo baseurl=http://pkgrepo.linuxtech.net/el6/release/ >> $target\
&& echo enabled=1 >> $target\
&& echo gpgcheck=1 >> $target\
&& echo gpgkey=http://pkgrepo.linuxtech.net/el6/release/RPM-GPG-KEY-LinuxTECH.NET >> $target

RUN yum update -y

RUN yum install -y libpng-devel libjpeg-devel libtiff-devel libuuid-devel gcc
RUN yum install -y make zip tar file libpng-devel libjpeg-devel libtiff-devel libuuid-devel gcc gzip liblcms2-devel freetype libXext libSM

ARG GM_VERSION
ARG GS_VERSION

RUN curl https://versaweb.dl.sourceforge.net/project/graphicsmagick/graphicsmagick/${GM_VERSION}/GraphicsMagick-${GM_VERSION}.tar.xz | tar -xJ && \
RUN curl https://versaweb.dl.sourceforge.net/project/graphicsmagick/graphicsmagick/${GM_VERSION}/GraphicsMagick-${GM_VERSION}.tar.gz | tar -xvz && \
cd GraphicsMagick-${GM_VERSION} && \
./configure --prefix=/opt --enable-shared=no --enable-static=yes --with-gs-font-dir=/opt/share/fonts/default/Type1 && \
make && \
Expand All @@ -27,12 +35,22 @@ RUN cp /usr/lib64/liblcms2.so* /opt/lib && \
cp /usr/lib64/libjbig.so* /opt/lib && \
cp /usr/lib64/libxcb.so* /opt/lib && \
cp /usr/lib64/libXau.so* /opt/lib && \
cp /usr/lib64/libuuid.so /opt/lib/libuuid.so.1 && \
cp /usr/lib64/libbz2.so /opt/lib/libbz2.so.1
cp /usr/lib64/libuuid.so /opt/lib/libuuid.so.1
#cp /usr/lib64/libbz2.so* /opt/lib/libbz2.so.1



RUN mkdir -p /opt/share/fonts/default && \
cp -R /usr/share/fonts/default/Type1 /opt/share/fonts/default/Type1
# RUN mkdir -p /opt/share/fonts/default && \
# cp -R /usr/share/fonts/default/Type1 /opt/share/fonts/default/Type1

RUN curl -L https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${GS_VERSION//./}/ghostscript-${GS_VERSION}.tar.gz | tar -xvz
RUN cd ghostscript-${GS_VERSION} && ./configure && make
RUN cd ghostscript-${GS_VERSION} && make install
RUN cp /usr/local/bin/gs /opt/bin/
RUN gs --version

RUN cd /opt && \
find . ! -perm -o=r -exec chmod +400 {} \; && \
zip -yr /tmp/gm-${GM_VERSION}.zip ./*


12 changes: 11 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#!/bin/sh

export GM_VERSION=1.3.31
export GS_VERSION=9.50

docker build --build-arg GM_VERSION -t gm-lambda-layer .
docker build --build-arg GM_VERSION --build-arg GS_VERSION -t gm-lambda-layer .
docker run --rm gm-lambda-layer cat /tmp/gm-${GM_VERSION}.zip > ./layer.zip

FONT_TARGET=./tmp/share/fonts/default/
mkdir -p $FONT_TARGET
cp -R ./font/* $FONT_TARGET
cd tmp && zip -ur ./../layer.zip ./share
cd ..
rm -rf ./tmp


Binary file added font/.DS_Store
Binary file not shown.
Loading