Skip to content

Commit e329c38

Browse files
Merge pull request #1 from propstack/feat/libreoffice-6
Feat/libreoffice 6
2 parents 5f36f0f + edf72a7 commit e329c38

8 files changed

+139
-1274
lines changed

.gitignore

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.idea/
2-
.terraform/
3-
*.tfstate.lock.info
4-
*.tfstate.backup
5-
*.backup
6-
lo.tar.gz
7-
layers.zip
1+
# build output
2+
layer
3+
layer.zip

Dockerfile

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
FROM amazonlinux:2.0.20190508 as lobuild
1+
FROM public.ecr.aws/lambda/nodejs:14.2022.02.01.09-x86_64 as lobuild
22

33
# see https://stackoverflow.com/questions/2499794/how-to-fix-a-locale-setting-warning-from-perl
44
ENV LC_CTYPE=en_US.UTF-8
55
ENV LC_ALL=en_US.UTF-8
66

7-
ENV LIBREOFFICE_VERSION=6.2.1.2
7+
ENV LIBREOFFICE_VERSION=6.4.7.2
88

99
# install basic stuff required for compilation
1010
RUN yum install -y yum-utils \
@@ -53,16 +53,27 @@ RUN cd /tmp \
5353
&& curl -L https://github.com/LibreOffice/core/archive/libreoffice-${LIBREOFFICE_VERSION}.tar.gz | tar -xz \
5454
&& mv core-libreoffice-${LIBREOFFICE_VERSION} libreoffice
5555

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+
5672
WORKDIR /tmp/libreoffice
5773

5874
# see https://ask.libreoffice.org/en/question/72766/sourcesver-missing-while-compiling-from-source/
5975
RUN echo "lo_sources_ver=${LIBREOFFICE_VERSION}" >> sources.ver
6076

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-
6677
RUN ./autogen.sh \
6778
--disable-avahi \
6879
--disable-cairo-canvas \
@@ -78,12 +89,9 @@ RUN ./autogen.sh \
7889
--disable-extension-update \
7990
--disable-firebird-sdbc \
8091
--disable-gio \
81-
--disable-gstreamer-0-10 \
8292
--disable-gstreamer-1-0 \
83-
--disable-gtk \
8493
--disable-gtk3 \
8594
--disable-introspection \
86-
--disable-kde4 \
8795
--disable-largefile \
8896
--disable-lotuswordpro \
8997
--disable-lpsolve \
@@ -100,11 +108,6 @@ RUN ./autogen.sh \
100108
--disable-sdremote-bluetooth \
101109
--enable-mergelibs \
102110
--with-galleries="no" \
103-
--with-system-curl \
104-
--with-system-expat \
105-
--with-system-libxml \
106-
--with-system-nss \
107-
--with-system-openssl \
108111
--with-theme="no" \
109112
--without-export-validation \
110113
--without-fonts \
@@ -135,16 +138,34 @@ RUN rm -rf ./instdir/share/gallery \
135138
./instdir/LICENSE* \
136139
./instdir/NOTICE
137140

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+
138159
# test if compilation was successful
139160
RUN echo "hello world" > a.txt \
140161
&& ./instdir/program/soffice --headless --invisible --nodefault --nofirststartwizard \
141162
--nolockcheck --nologo --norestore --convert-to pdf --outdir $(pwd) a.txt
142163

143164
RUN tar -cvf /tmp/lo.tar instdir/
144165

145-
FROM amazonlinux:2.0.20190508 as brotli
166+
FROM public.ecr.aws/lambda/nodejs:14.2022.02.01.09-x86_64 as brotli
146167

147-
ENV BROTLI_VERSION=1.0.7
168+
ENV BROTLI_VERSION=1.0.9
148169

149170
WORKDIR /tmp
150171

@@ -160,8 +181,11 @@ RUN yum install -y make zip unzip bc autoconf automake libtool \
160181

161182
COPY --from=lobuild /tmp/lo.tar .
162183

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
164187

165-
FROM amazonlinux:2.0.20190508
188+
COPY --from=brotli /tmp/layer.zip /tmp
166189

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

Comments
 (0)