简体   繁体   中英

How to use gifsicle in AWS lambda

Is there a way to use gifsicle in AWS lambda? I know there is a package called pygifsicle , but it seems it requires the gifsicle version of AWS Linux 2?

I don't see a binary built for RedHat version of gifsicle

So my questions are,

Do I need to build one for AWS Linux 2 to use it along with pygifsicle? Even if I build gifsicle for AWS Linux 2, how to use it along with pygifsicle?

As I read the documentation you can build one binary for Building Gifsicle on UNIX and can package that with your lambda zip file which can be called as a normal command in lambda function.

Like it is being called in the pygifsicle

subprocess.call(["gifsicle", *options, *sources, "--colors",
                str(colors), "--output", destination])

My Dockerfile where I'm building it from the source.

FROM public.ecr.aws/lambda/python:3.8-arm64

RUN yum -y install install make gcc wget gzip

RUN wget https://www.lcdf.org/gifsicle/gifsicle-1.93.tar.gz
RUN tar -xzf gifsicle-1.93.tar.gz
RUN cd gifsicle-1.93 && \
    ./configure && \
    make && \
    make install

COPY requirements.txt ./
RUN yum update -y && \
    pip install -r requirements.txt

COPY . .
CMD ["app.handler"]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM