1
- FROM amazonlinux:2.0.20190508 as lobuild
1
+ FROM public.ecr.aws/lambda/nodejs:14.2022.02.01.09-x86_64 as lobuild
2
2
3
3
# see https://stackoverflow.com/questions/2499794/how-to-fix-a-locale-setting-warning-from-perl
4
4
ENV LC_CTYPE=en_US.UTF-8
5
5
ENV LC_ALL=en_US.UTF-8
6
6
7
- ENV LIBREOFFICE_VERSION=6.2.1 .2
7
+ ENV LIBREOFFICE_VERSION=6.4.7 .2
8
8
9
9
# install basic stuff required for compilation
10
10
RUN yum install -y yum-utils \
@@ -53,16 +53,27 @@ RUN cd /tmp \
53
53
&& curl -L https://github.com/LibreOffice/core/archive/libreoffice-${LIBREOFFICE_VERSION}.tar.gz | tar -xz \
54
54
&& mv core-libreoffice-${LIBREOFFICE_VERSION} libreoffice
55
55
56
+ # install required gperf 3.1
57
+ RUN cd /tmp \
58
+ && curl -L http://ftp.gnu.org/pub/gnu/gperf/gperf-3.1.tar.gz | tar -xz \
59
+ && cd gperf-3.1 \
60
+ && ./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.1 && make && make -j1 check && make install && gperf --version
61
+
62
+ # install required flex 2.6.4
63
+ RUN cd /tmp \
64
+ && curl -L https://github.com/westes/flex/files/981163/flex-2.6.4.tar.gz | tar -xz \
65
+ && cd flex-2.6.4 \
66
+ && ./autogen.sh && ./configure && make && make install && flex --version
67
+
68
+
69
+ # install liblangtag
70
+ RUN yum repolist && yum install -y liblangtag && cp -r /usr/share/liblangtag /usr/local/share/liblangtag/
71
+
56
72
WORKDIR /tmp/libreoffice
57
73
58
74
# see https://ask.libreoffice.org/en/question/72766/sourcesver-missing-while-compiling-from-source/
59
75
RUN echo "lo_sources_ver=${LIBREOFFICE_VERSION}" >> sources.ver
60
76
61
- # install liblangtag (not available in Amazon Linux or EPEL repos)
62
- # paste repo info from https://unix.stackexchange.com/questions/433046/how-do-i-enable-centos-repositories-on-rhel-red-hat
63
- COPY config/centos.repo /etc/yum.repos.d/
64
- RUN yum repolist && yum install -y liblangtag && cp -r /usr/share/liblangtag /usr/local/share/liblangtag/
65
-
66
77
RUN ./autogen.sh \
67
78
--disable-avahi \
68
79
--disable-cairo-canvas \
@@ -78,12 +89,9 @@ RUN ./autogen.sh \
78
89
--disable-extension-update \
79
90
--disable-firebird-sdbc \
80
91
--disable-gio \
81
- --disable-gstreamer-0-10 \
82
92
--disable-gstreamer-1-0 \
83
- --disable-gtk \
84
93
--disable-gtk3 \
85
94
--disable-introspection \
86
- --disable-kde4 \
87
95
--disable-largefile \
88
96
--disable-lotuswordpro \
89
97
--disable-lpsolve \
@@ -100,11 +108,6 @@ RUN ./autogen.sh \
100
108
--disable-sdremote-bluetooth \
101
109
--enable-mergelibs \
102
110
--with-galleries="no" \
103
- --with-system-curl \
104
- --with-system-expat \
105
- --with-system-libxml \
106
- --with-system-nss \
107
- --with-system-openssl \
108
111
--with-theme="no" \
109
112
--without-export-validation \
110
113
--without-fonts \
@@ -135,16 +138,34 @@ RUN rm -rf ./instdir/share/gallery \
135
138
./instdir/LICENSE* \
136
139
./instdir/NOTICE
137
140
141
+ # install required tooling for shared object handling
142
+ RUN yum install -y rpmdevtools
143
+ WORKDIR /tmp/rpms
144
+
145
+ # add shared objects that are missing in the aws lambda docker container
146
+ RUN yumdownloader libX11.x86_64 libxcb.x86_64 libXau.x86_64 libxslt.x86_64 fontconfig.x86_64 freetype.x86_64 \
147
+ libXext.x86_64 libSM.x86_64 libICE.x86_64 libXrender.x86_64 libpng.x86_64
148
+
149
+ # add shared object that are missing the aws lambda runtime
150
+ RUN yumdownloader libxml2.x86_64 expat.x86_64 libuuid.x86_64 xz-libs.x86_64 bzip2-libs.x86_64
151
+
152
+ # extract and add shared objects to program folder
153
+ RUN rpmdev-extract *.rpm
154
+ WORKDIR /tmp
155
+ RUN mv ./rpms/*/usr/lib64/* ./libreoffice/instdir/program
156
+
157
+ WORKDIR /tmp/libreoffice
158
+
138
159
# test if compilation was successful
139
160
RUN echo "hello world" > a.txt \
140
161
&& ./instdir/program/soffice --headless --invisible --nodefault --nofirststartwizard \
141
162
--nolockcheck --nologo --norestore --convert-to pdf --outdir $(pwd) a.txt
142
163
143
164
RUN tar -cvf /tmp/lo.tar instdir/
144
165
145
- FROM amazonlinux:2.0.20190508 as brotli
166
+ FROM public.ecr.aws/lambda/nodejs:14.2022.02.01.09-x86_64 as brotli
146
167
147
- ENV BROTLI_VERSION=1.0.7
168
+ ENV BROTLI_VERSION=1.0.9
148
169
149
170
WORKDIR /tmp
150
171
@@ -160,8 +181,11 @@ RUN yum install -y make zip unzip bc autoconf automake libtool \
160
181
161
182
COPY --from=lobuild /tmp/lo.tar .
162
183
163
- RUN brotli --best /tmp/lo.tar && zip -r layers.zip lo.tar.br
184
+ RUN brotli --best /tmp/lo.tar && zip -r layer.zip lo.tar.br
185
+
186
+ FROM public.ecr.aws/lambda/nodejs:14.2022.02.01.09-x86_64
164
187
165
- FROM amazonlinux:2.0.20190508
188
+ COPY --from=brotli /tmp/layer.zip /tmp
166
189
167
- COPY --from=brotli /tmp/layers.zip /tmp
190
+ # overwrite entrypoint as aws base image tries to run a handler function
191
+ ENTRYPOINT []
0 commit comments