I have a Python Lambda function that should create a PDF report. I tried to add a custom Dockerfile to install Latex at Lambda similar to https://github.com/samoconnor/lambdalatex 1
But the function cannot find the installed Latex files. (The copied file template.tex at the end of the Dockerfile is there)
My serverless.yaml:
plugins:
- serverless-python-requirements
custom:
pythonRequirements:
dockerizePip: non-linux
dockerFile: Dockerfile
The Dockerfile:
FROM lambci/lambda:build-python3.6
# The TeXLive installer needs md5 and wget.
RUN yum -y install perl-Digest-MD5 && \
yum -y install wget \
yum -y install latexmk
RUN mkdir /var/src
WORKDIR /var/src
# Download TeXLive installer.
ADD http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz /var/src/
#COPY install-tl-unx.tar.gz /var/src/
# Minimal TeXLive configuration profile.
COPY texlive.profile /var/src/
# Intstall base TeXLive system.
RUN tar xf install*.tar.gz
RUN cd install-tl-* && \
./install-tl --profile ../texlive.profile
ENV PATH=/var/task/texlive/2017/bin/x86_64-linux/:$PATH
# Install extra packages.
RUN tlmgr install xcolor \
tcolorbox \
pgf \
environ \
trimspaces \
etoolbox \
booktabs \
lastpage \
pgfplots \
marginnote \
tabu \
varwidth \
makecell \
enumitem \
setspace \
xwatermark \
catoptions \
ltxkeys \
framed \
parskip \
endnotes \
footmisc \
zapfding \
symbol \
lm \
sectsty \
stringstrings \
koma-script \
multirow \
calculator \
adjustbox \
xkeyval \
collectbox \
siunitx \
l3kernel \
l3packages \
helvetic \
charter \
latexmk
# Install latexmk.
RUN tlmgr install latexmk
# Remove LuaTeX.
RUN tlmgr remove --force luatex
# Remove large unneeded files.
RUN rm -rf /var/task/texlive/2017/tlpkg/texlive.tlpdb* \
/var/task/texlive/2017/texmf-dist/source/latex/koma-script/doc \
/var/task/texlive/2017/texmf-dist/doc
RUN mkdir -p /var/task/texlive/2017/tlpkg/TeXLive/Digest/ && \
mkdir -p /var/task/texlive/2017/tlpkg/TeXLive/auto/Digest/MD5/ && \
cp /usr/lib64/perl5/vendor_perl/Digest/MD5.pm \
/var/task/texlive/2017/tlpkg/TeXLive/Digest/ && \
cp /usr/lib64/perl5/vendor_perl/auto/Digest/MD5/MD5.so \
/var/task/texlive/2017/tlpkg/TeXLive/auto/Digest/MD5
FROM lambci/lambda:build-python3.6
WORKDIR /var/task
ENV PATH=/var/task/texlive/2017/bin/x86_64-linux/:$PATH
ENV PERL5LIB=/var/task/texlive/2017/tlpkg/TeXLive/
COPY template.tex /var/task/
The Python requirements from the requirements.txt are working perfectly.
Here is the output of the deploy from the Docker part:
Serverless: Building custom docker image from Dockerfile… Serverless: Docker Image: sls-py-reqs-custom
Do you have any idea what I am doing wrong?