-
Notifications
You must be signed in to change notification settings - Fork 271
/
Dockerfile.CompressImages
37 lines (28 loc) · 1.59 KB
/
Dockerfile.CompressImages
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
FROM mcr.microsoft.com/dotnet/sdk:6.0-focal AS dotnet
COPY . /src/
RUN mkdir -p /home/site/wwwroot
RUN cd /src/CompressImagesFunction && dotnet publish CompressImagesFunction.csproj -c Release --output /home/site/wwwroot
# Native Binaries
RUN cd /src/CompressImagesFunction && cp bin/Release/net6.0/runtimes/linux-x64/native/libgit2-b7bad55.so /home/site/wwwroot/bin/
RUN cd /src/CompressImagesFunction && cp bin/Release/net6.0/runtimes/linux-x64/native/Magick.Native-Q16-x64.dll.so /home/site/wwwroot/bin/
FROM mcr.microsoft.com/azure-functions/dotnet:4
RUN apt-get update && apt-get install -y --no-install-recommends --no-install-suggests \
curl libcurl4 autoconf automake libtool nasm make wget pkg-config
RUN curl -sL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g svgo@^1.3.2
# Add support for mozjpeg
RUN cd /tmp && wget https://github.com/mozilla/mozjpeg/archive/v3.3.1.tar.gz
RUN cd /tmp && tar -xzf v3.3.1.tar.gz
RUN cd /tmp/mozjpeg-3.3.1 && autoreconf -fiv
RUN mkdir /tmp/mozjpeg-3.3.1/build
RUN cd /tmp/mozjpeg-3.3.1/build && sh ../configure && make install
RUN ln -s /opt/mozjpeg/bin/jpegtran /usr/local/bin/mozjpegtran
RUN ln -s /opt/mozjpeg/bin/cjpeg /usr/local/bin/mozcjpeg
# Add support for gifsicle
RUN cd /tmp && wget https://github.com/kohler/gifsicle/archive/v1.92.tar.gz
RUN cd /tmp && tar -xzf v1.92.tar.gz
RUN cd /tmp/gifsicle-1.92 && autoreconf -fiv
RUN cd /tmp/gifsicle-1.92 && sh ./configure --disable-gifview && make install
ENV AzureWebJobsScriptRoot=/home/site/wwwroot
COPY --from=dotnet ["/home/site/wwwroot", "/home/site/wwwroot"]