-
Notifications
You must be signed in to change notification settings - Fork 31
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
libvips-amazonlinux2-sharp issue #16
Comments
Hi @maxguzenski, this isn't my code, I think I was experimenting with it a while ago. As I recall it's a copy of the thing Lovell uses to build sharp, I'd check over there. |
Yes, I notice. But lovell compile everything with "--enable-static". There is another repo that build libvips to aws lambda, that use ldd as I told you. https://github.com/zoellner/sharp-heic-lambda-layer/blob/main/layer/Makefile#L19 How I sad I am not a c/c++ programmer, and I dont full understand all those compile parameters. I discovery "ldd" command yesterday. But on my test "readelf" list +/- 10 deps (only direct deps), and ldd list a full tree of deps, with more then 70 libs to copy. |
I did this one: https://github.com/jcupitt/docker-builds/tree/master/ruby-vips-amazonlinux That's ruby-vips with libvips on lambda. Maybe adapt something like that? It's relatively simple (Lovell's build is rather complex). |
I'm trying deploy a aws lambda as a docker image (now aws support that). Your code (and lovell's code) taken long time to compile on my notebook then is hard to test it correctly. I end up with this docker that use multi stage, final image takes only 350mb and it works very well. I compile everthing on first docker then move libs with "ldd" to a new one. I used ubuntu but I will retry with amazon linux. It's a work in progress. FROM ubuntu:21.10 as builder
ENV DEBIAN_FRONTEND=noninteractive
ARG FUNCTION_DIR
RUN apt-get update
RUN apt-get install -y \
curl \
build-essential \
cmake \
git \
autoconf \
libtool \
gtk-doc-tools \
gobject-introspection
# libpango1.0-dev \
# libopenjp2-7-dev \
# libgsf-1-dev \
# libjpeg-turbo8-dev \ -> wil use mozjpeg
RUN apt-get install -y \
libexpat1-dev \
librsvg2-dev \
libpng-dev \
libgif-dev \
libexif-dev \
liblcms2-dev \
liborc-dev \
libwebp-dev \
libheif-dev
WORKDIR /usr/local/src
#
# Install mozjpeg
# A more performance version of libjpeg
# other options
# -DENABLE_STATIC=TRUE \
# -DENABLE_SHARED=FALSE \
#
RUN git clone https://github.com/mozilla/mozjpeg \
&& cd mozjpeg \
&& git checkout v4.0.3 \
&& CFLAGS="-O3" cmake -G"Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX=/opt \
-DCMAKE_INSTALL_LIBDIR=/opt/lib \
-DWITH_JPEG8=1 \
-DWITH_TURBOJPEG=FALSE \
&& make install/strip
#
# Install libvips
#
RUN git clone https://github.com/libvips/libvips \
&& cd libvips \
&& git checkout 8.12 \
&& CFLAGS="-O3" ./autogen.sh --prefix=/opt \
&& make V=0 \
&& make install
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get update
RUN apt-get install -y nodejs
#
# Configure pkg-config
#
ENV PKG_CONFIG_PATH /opt/lib/pkgconfig
RUN echo "/opt/lib" > /etc/ld.so.conf.d/vips-cpp.conf
RUN ldconfig
RUN mkdir /app
WORKDIR /app
#
# npm sharp has to be insalled here because it needs *-dev libs.
#
COPY src/* package.json /app
RUN npm install .
#
# Copy all necessary libs to a new folder.
#
RUN mkdir -p /opt/local/lib
RUN ldd node_modules/sharp/build/Release/sharp-linux-x64.node | sed -nE "s/^[^\/\n]*(\/[^ ]+)(.*)/\1/p" | xargs cp -t /opt/local/lib
# ------- deploy image -------
FROM ubuntu:21.10
ENV DEBIAN_FRONTEND=noninteractive
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
nodejs \
python3 \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /opt/local/lib /opt/lib
COPY --from=builder /app /app
COPY src/* /app
RUN echo "/opt/lib" > /etc/ld.so.conf.d/vips-cpp.conf \
&& ldconfig
CMD ["/bin/bash"] |
Hi
First, I'm a webdeveloper, not a c/c++ developer.
But my question is:
in the way you are copying deps on libvips-amazonlinux2-sharp/build/vips.sh are you not losing some deps of deps?
This code above shouldn't be ...
??
The text was updated successfully, but these errors were encountered: