forked from colthreepv/docker-image_optim
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.dev
164 lines (135 loc) · 4.74 KB
/
Dockerfile.dev
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
FROM docker.io/library/alpine:3
ENV RUBY_YJIT_ENABLE=1
ENV \
# https://github.com/amadvance/advancecomp/releases
ADVANCECOMP_VERSION=2.6 \
# https://github.com/kohler/gifsicle/tags
GIFSICLE_VERSION=1.95 \
# http://www.ijg.org/
IJG_VERSION=9f \
JHEAD_VERSION=3.04 \
# https://github.com/danielgtaylor/jpeg-archive/releases
JPEGARCHIVE_VERSION=2.2.0 \
# https://www.kokkonen.net/tjko/projects.html#jpegoptim
JPEGOPTIM_VERSION=1.5.5 \
# https://github.com/mozilla/mozjpeg/releases
MOZJPEG_VERSION=4.1.1 \
# https://sourceforge.net/projects/optipng/files/OptiPNG/
OPTIPNG_VERSION=0.7.8 \
# https://sourceforge.net/projects/pmt/files/pngcrush/
PNGCRUSH_VERSION=1.8.13 \
PNGOUT_VERSION=20150319 \
# https://github.com/kornelski/pngquant/tags
PNGQUANT_VERSION=3.0.3 \
# https://github.com/ImageOptim/libimagequant/tags
LIBIMAGEQUANT_VERSION=4.3.3
WORKDIR /tmp
# This step installs all external utilities, leaving only the
# compiled/installed binaries behind in order minimize the
# footprint of the image layer.
RUN apk update && apk add \
# runtime dependencies
# advcomp (libstdc++.so, libgcc_s.so)
libstdc++ \
# jpegoptim (libjpeg.so)
libjpeg-turbo \
# pngquant
libpng \
# svgo
nodejs yarn \
# image_optim
ruby \
# build dependencies
&& apk add --virtual build-dependencies \
build-base \
# jpegoptim
libjpeg-turbo-dev \
# advancecomp
zlib-dev \
# pngquant
bash libpng-dev \
# mozjpeg
pkgconfig autoconf automake libtool nasm \
# utils
curl \
# image_optim
ruby-irb
# advancecomp
RUN \
curl -L -O https://github.com/amadvance/advancecomp/releases/download/v$ADVANCECOMP_VERSION/advancecomp-$ADVANCECOMP_VERSION.tar.gz \
&& tar zxf advancecomp-$ADVANCECOMP_VERSION.tar.gz \
&& cd advancecomp-$ADVANCECOMP_VERSION \
&& ./configure && make && make install
# gifsicle
RUN \
curl -L -O https://github.com/kohler/gifsicle/archive/refs/tags/v$GIFSICLE_VERSION.tar.gz \
&& tar zxf v$GIFSICLE_VERSION.tar.gz \
&& cd gifsicle-$GIFSICLE_VERSION \
&& autoreconf -i && ./configure && make && make install
# jhead
RUN \
curl -O https://www.sentex.net/~mwandel/jhead/jhead-$JHEAD_VERSION.tar.gz \
&& tar zxf jhead-$JHEAD_VERSION.tar.gz \
&& cd jhead-$JHEAD_VERSION \
&& make && make install
# jpegoptim
RUN \
curl -O https://www.kokkonen.net/tjko/src/jpegoptim-$JPEGOPTIM_VERSION.tar.gz \
&& tar zxf jpegoptim-$JPEGOPTIM_VERSION.tar.gz \
&& cd jpegoptim-$JPEGOPTIM_VERSION \
&& ./configure && make && make install
# jpeg-recompress (from jpeg-archive along with mozjpeg dependency)
RUN \
curl -L -O https://github.com/mozilla/mozjpeg/archive/v$MOZJPEG_VERSION.tar.gz \
&& tar zxf v$MOZJPEG_VERSION.tar.gz \
&& cd mozjpeg-$MOZJPEG_VERSION \
&& autoreconf -fiv && ./configure && make && make install
RUN \
curl -L -O https://github.com/danielgtaylor/jpeg-archive/archive/v$JPEGARCHIVE_VERSION.tar.gz \
&& tar zxf v$JPEGARCHIVE_VERSION.tar.gz \
&& cd jpeg-archive-$JPEGARCHIVE_VERSION \
&& make && make install
# jpegtran (from Independent JPEG Group)
RUN \
curl -O http://www.ijg.org/files/jpegsrc.v$IJG_VERSION.tar.gz \
&& tar zxf jpegsrc.v$IJG_VERSION.tar.gz \
&& cd jpeg-$IJG_VERSION \
&& ./configure && make && make install
# optipng
RUN \
curl -L -O http://downloads.sourceforge.net/project/optipng/OptiPNG/optipng-$OPTIPNG_VERSION/optipng-$OPTIPNG_VERSION.tar.gz \
&& tar zxf optipng-$OPTIPNG_VERSION.tar.gz \
&& cd optipng-$OPTIPNG_VERSION \
&& ./configure && make && make install
# pngcrush
RUN \
curl -L -O http://downloads.sourceforge.net/project/pmt/pngcrush/$PNGCRUSH_VERSION/pngcrush-$PNGCRUSH_VERSION.tar.gz \
&& tar zxf pngcrush-$PNGCRUSH_VERSION.tar.gz \
&& cd pngcrush-$PNGCRUSH_VERSION \
&& make && cp -f pngcrush /usr/local/bin
# pngout (binary distrib)
RUN \
curl -O https://www.jonof.id.au/files/kenutils/pngout-$PNGOUT_VERSION-linux-static.tar.gz \
&& tar zxf pngout-$PNGOUT_VERSION-linux-static.tar.gz \
&& cd pngout-$PNGOUT_VERSION-linux-static \
&& cp -f x86_64/pngout-static /usr/local/bin/pngout
# pngquant
RUN \
curl -L -O https://github.com/ImageOptim/libimagequant/archive/refs/tags/$LIBIMAGEQUANT_VERSION.tar.gz \
&& tar xzf $LIBIMAGEQUANT_VERSION.tar.gz \
&& curl -L -O https://github.com/kornelski/pngquant/archive/refs/tags/$PNGQUANT_VERSION.tar.gz \
&& tar xzf $PNGQUANT_VERSION.tar.gz \
&& mv libimagequant-$LIBIMAGEQUANT_VERSION/* pngquant-$PNGQUANT_VERSION/lib/ \
&& cd pngquant-$PNGQUANT_VERSION \
&& ./configure && make && make install
# svgo
RUN yarn global add svgo --prefix /usr/local
# image_optim
RUN \
echo -e 'install: --no-document\nupdate: --no-document' > "$HOME/.gemrc" \
&& gem install --no-document image_optim
# cleanup
RUN \
rm -rf /tmp/* \
&& apk del build-dependencies
WORKDIR /images