|
1 | 1 | # Copy from https://github.com/customink/ruby-vips-lambda/blob/master/Dockerfile
|
2 | 2 | FROM lambci/lambda:build-ruby2.7
|
3 | 3 |
|
| 4 | +WORKDIR /build |
| 5 | + |
| 6 | +ARG VIPS_VERSION=8.10.0 |
| 7 | + |
| 8 | +ENV VIPS_VERSION=$VIPS_VERSION |
| 9 | +ENV PATH=/opt/bin:$PATH |
| 10 | +ENV LD_LIBRARY_PATH=/opt/lib:/opt/lib64:$LD_LIBRARY_PATH |
| 11 | +ENV PKG_CONFIG_PATH=/opt/lib/pkgconfig:/opt/lib64/pkgconfig |
| 12 | +ENV CFLAGS="-fexceptions -Wall -O3" |
| 13 | +ENV CXXFLAGS="${CFLAGS}" |
| 14 | + |
| 15 | +# Setup Some Dirs |
| 16 | +# |
| 17 | +RUN mkdir -p \ |
| 18 | + share/lib \ |
| 19 | + share/include |
| 20 | + |
| 21 | +# Install expat |
| 22 | +# |
| 23 | +RUN curl https://codeload.github.com/libexpat/libexpat/zip/R_2_2_9 > libexpat-R_2_2_9.zip && \ |
| 24 | + unzip libexpat-R_2_2_9.zip && \ |
| 25 | + cd ./libexpat-R_2_2_9/expat && \ |
| 26 | + ./buildconf.sh && \ |
| 27 | + ./configure --prefix=/opt && \ |
| 28 | + make install |
| 29 | + |
| 30 | +RUN cp -a /opt/lib/libexpat.so* /build/share/lib |
| 31 | + |
| 32 | +# Install libpng |
| 33 | +# |
| 34 | +RUN curl -L https://downloads.sourceforge.net/libpng/libpng-1.6.37.tar.xz > libpng-1.6.37.tar.xz && \ |
| 35 | + tar -xf libpng-1.6.37.tar.xz && \ |
| 36 | + cd libpng-1.6.37 && \ |
| 37 | + ./configure --prefix=/opt --disable-static && \ |
| 38 | + make && \ |
| 39 | + make install |
| 40 | + |
| 41 | +RUN cp -a /opt/lib/libpng.so* /build/share/lib && \ |
| 42 | + cp -a /opt/lib/libpng16.so* /build/share/lib |
| 43 | + |
| 44 | +# Install giflib |
| 45 | +# |
| 46 | +RUN curl -L https://sourceforge.net/projects/giflib/files/giflib-5.2.1.tar.gz > giflib-5.2.1.tar.gz && \ |
| 47 | + tar -xf giflib-5.2.1.tar.gz && \ |
| 48 | + cd giflib-5.2.1 && \ |
| 49 | + make && \ |
| 50 | + make PREFIX=/opt install |
| 51 | + |
| 52 | +RUN cp -a /opt/lib/libgif.so* /build/share/lib |
| 53 | + |
| 54 | +# Install libjpeg-turbo |
| 55 | +# |
| 56 | +RUN curl -L https://downloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-2.0.4.tar.gz > libjpeg-turbo-2.0.4.tar.gz && \ |
| 57 | + tar -xf libjpeg-turbo-2.0.4.tar.gz && \ |
| 58 | + cd libjpeg-turbo-2.0.4 && \ |
| 59 | + cmake -DCMAKE_INSTALL_PREFIX=/opt && \ |
| 60 | + make && \ |
| 61 | + make install |
| 62 | + |
| 63 | +RUN cp -a /opt/lib64/libjpeg.so* /build/share/lib && \ |
| 64 | + cp -a /opt/lib64/libturbojpeg.so* /build/share/lib |
| 65 | + |
| 66 | +# Install libimagequant |
| 67 | +# |
| 68 | +RUN git clone https://github.com/ImageOptim/libimagequant.git && \ |
| 69 | + cd ./libimagequant && \ |
| 70 | + git checkout 2.12.6 && \ |
| 71 | + ./configure --prefix=/opt && \ |
| 72 | + make libimagequant.so && \ |
| 73 | + make install && \ |
| 74 | + echo /opt/lib > /etc/ld.so.conf.d/libimagequant.conf && \ |
| 75 | + ldconfig |
| 76 | + |
| 77 | +RUN cp -a /opt/lib/libimagequant.so* /build/share/lib/ && \ |
| 78 | + cp -a /opt/include/libimagequant.h /build/share/include/ |
| 79 | + |
| 80 | +# Install libfftw |
| 81 | +# |
| 82 | +RUN curl -L http://www.fftw.org/fftw-3.3.8.tar.gz > fftw-3.3.8.tar.gz && \ |
| 83 | + tar -xf fftw-3.3.8.tar.gz && \ |
| 84 | + cd ./fftw-3.3.8 && \ |
| 85 | + ./configure \ |
| 86 | + --prefix=/opt \ |
| 87 | + --enable-shared \ |
| 88 | + --disable-static \ |
| 89 | + --enable-threads \ |
| 90 | + --enable-sse2 \ |
| 91 | + --enable-avx && \ |
| 92 | + make && \ |
| 93 | + make install |
| 94 | + |
| 95 | +RUN cp -a /opt/lib/libfftw3* /build/share/lib/ |
| 96 | + |
| 97 | +# Install liborc (perf) |
| 98 | +# |
| 99 | +RUN curl -L https://gstreamer.freedesktop.org/data/src/orc/orc-0.4.26.tar.xz > orc-0.4.26.tar.xz && \ |
| 100 | + tar -xf orc-0.4.26.tar.xz && \ |
| 101 | + cd orc-0.4.26 && \ |
| 102 | + ./configure --prefix=/opt && \ |
| 103 | + make && \ |
| 104 | + make install |
| 105 | +RUN cp -a /opt/lib/liborc-0.4.so* /build/share/lib/ |
| 106 | + |
| 107 | +# Install libvips. Primary deps https://libvips.github.io/libvips/install.html |
| 108 | +# |
| 109 | +RUN yum install -y \ |
| 110 | + gtk-doc \ |
| 111 | + ninja-build |
| 112 | + |
| 113 | +RUN pip3 install meson && \ |
| 114 | + pip3 install ninja |
| 115 | + |
| 116 | +RUN curl -L http://ftp.gnome.org/pub/gnome/sources/glib/2.64/glib-2.64.2.tar.xz > glib-2.64.2.tar.xz && \ |
| 117 | + tar -xf glib-2.64.2.tar.xz && \ |
| 118 | + cd glib-2.64.2 && \ |
| 119 | + mkdir ./_build && \ |
| 120 | + cd ./_build && \ |
| 121 | + meson --prefix=/opt .. && \ |
| 122 | + ninja && \ |
| 123 | + ninja install |
| 124 | + |
| 125 | +RUN cp -a /opt/lib64/libffi.so* /build/share/lib && \ |
| 126 | + cp -a /opt/lib64/libgio-2.0.so* /build/share/lib && \ |
| 127 | + cp -a /opt/lib64/libglib-2.0.so* /build/share/lib && \ |
| 128 | + cp -a /opt/lib64/libgmodule-2.0.so* /build/share/lib && \ |
| 129 | + cp -a /opt/lib64/libgobject-2.0.so* /build/share/lib && \ |
| 130 | + cp -a /opt/lib64/libgthread-2.0.so* /build/share/lib |
| 131 | + |
| 132 | +RUN curl -L http://ftp.gnome.org/pub/gnome/sources/gobject-introspection/1.64/gobject-introspection-1.64.1.tar.xz > gobject-introspection-1.64.1.tar.xz && \ |
| 133 | + tar -xf gobject-introspection-1.64.1.tar.xz && \ |
| 134 | + cd gobject-introspection-1.64.1 && \ |
| 135 | + mkdir ./_build && \ |
| 136 | + cd ./_build && \ |
| 137 | + meson --prefix=/opt .. && \ |
| 138 | + ninja && \ |
| 139 | + ninja install |
| 140 | + |
| 141 | +# Install libvips. |
| 142 | +# |
| 143 | +RUN curl -L https://github.com/libvips/libvips/releases/download/v${VIPS_VERSION}/vips-${VIPS_VERSION}.tar.gz > vips-${VIPS_VERSION}.tar.gz && \ |
| 144 | + tar -xf vips-${VIPS_VERSION}.tar.gz && \ |
| 145 | + cd vips-${VIPS_VERSION} && \ |
| 146 | + ./configure \ |
| 147 | + --prefix=/opt \ |
| 148 | + --disable-gtk-doc \ |
| 149 | + --without-magick \ |
| 150 | + --with-expat=/opt \ |
| 151 | + --with-giflib-includes=/opt/local/include \ |
| 152 | + --with-giflib-libraries=/opt/local/lib && \ |
| 153 | + make && \ |
| 154 | + make install && \ |
| 155 | + echo /opt/lib > /etc/ld.so.conf.d/libvips.conf && \ |
| 156 | + ldconfig |
| 157 | + |
| 158 | +RUN cp -a /opt/lib/libvips.so* /build/share/lib |
| 159 | + |
| 160 | +# Store the VIPS_VERSION variable in a file, accessible to the deploy script. |
| 161 | +# |
| 162 | +RUN echo $VIPS_VERSION > "./share/VIPS_VERSION" |
| 163 | + |
| 164 | +# Create an /build/share/opt/lib64 symlink for shared objects. |
| 165 | +# |
| 166 | +RUN cd ./share && ln -s lib lib64 |
| 167 | + |
| 168 | +# Zip up contents so final `lib` can be placed in /opt layer. |
| 169 | +# |
| 170 | +RUN cd ./share && \ |
| 171 | + zip --symlinks -r libvips.zip . |
| 172 | + |
4 | 173 | # serverless frameworkのインストール
|
5 | 174 | RUN curl -sL https://rpm.nodesource.com/setup_12.x | bash - \
|
6 | 175 | && yum -y install nodejs && yum -y clean all \
|
|
0 commit comments