-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create working LibreOffice/Python/Node alpine image
Signed-off-by: Jeremy Ho <[email protected]>
- Loading branch information
Showing
3 changed files
with
82 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,24 @@ | ||
FROM node:10 | ||
FROM mhart/alpine-node:12 | ||
|
||
WORKDIR /tmp | ||
RUN wget http://downloadarchive.documentfoundation.org/libreoffice/old/6.3.3.1/deb/x86_64/LibreOffice_6.3.3.1_Linux_x86-64_deb.tar.gz -O libo.tar.gz | ||
RUN apt update \ | ||
&& apt install -y libxinerama1 libfontconfig1 libdbus-glib-1-2 libcairo2 libcups2 libglu1-mesa libsm6 unzip \ | ||
&& tar -zxvf libo.tar.gz \ | ||
&& cd LibreOffice_6.3.3.1_Linux_x86-64_deb/DEBS | ||
RUN dpkg -i *.deb | ||
ARG APP_ROOT=/opt/app-root/src | ||
|
||
# Install CDOGS | ||
WORKDIR /opt/app-root/src | ||
COPY . . | ||
RUN npm ci | ||
EXPOSE 3000 | ||
CMD ["npm", "run", "start"] | ||
|
||
|
||
# FROM node:lts-stretch | ||
|
||
# ARG LO_VERSION=6.3.4.2 | ||
|
||
# # Install Dependencies | ||
# RUN apt update \ | ||
# && apt install -y libxinerama1 libfontconfig1 libdbus-glib-1-2 libcairo2 libcups2 libglu1-mesa libsm6 unzip | ||
ENV PATH="/usr/lib/libreoffice/program:${PATH}" \ | ||
PYTHONUNBUFFERED=1 | ||
|
||
# # Install LibreOffice | ||
# WORKDIR /tmp | ||
# RUN wget https://downloadarchive.documentfoundation.org/libreoffice/old/${LO_VERSION}/src/libreoffice-${LO_VERSION}.tar.xz -O libo.tar.gz \ | ||
# && tar -zxvf libo.tar.gz | ||
# RUN cd LibreOffice_${LO_VERSION}_Linux_x86-64_deb/DEBS \ | ||
# && dpkg -i *.deb \ | ||
# && cd /tmp \ | ||
# && rm libo.tar.gz \ | ||
# && rm -rf LibreOffice_${LO_VERSION}_Linux_x86-64_deb/DEBS | ||
WORKDIR ${APP_ROOT} | ||
|
||
# # Install CDOGS | ||
# WORKDIR /opt/app-root/src | ||
# COPY . . | ||
# RUN npm ci | ||
# EXPOSE 3000 | ||
# CMD ["npm", "run", "start"] | ||
# Install LibreOffice & Common Fonts | ||
RUN apk --no-cache add bash libreoffice util-linux \ | ||
ttf-droid-nonlatin ttf-droid ttf-dejavu ttf-freefont ttf-liberation \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
# FROM mhart/alpine-node:12 | ||
# Fix Python/LibreOffice Integration | ||
COPY docker ${APP_ROOT}/docker | ||
RUN ${APP_ROOT}/docker/bindPython.sh | ||
|
||
# ENV PYTHONUNBUFFERED=1 | ||
|
||
# WORKDIR /opt/app-root/src | ||
|
||
# # Install LibreOffice | ||
# RUN apk --no-cache add libreoffice | ||
|
||
# # Install Python | ||
# RUN apk add --no-cache python3 \ | ||
# && if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi \ | ||
# && python3 -m ensurepip \ | ||
# && rm -r /usr/lib/python*/ensurepip \ | ||
# && pip install --no-cache --upgrade pip setuptools wheel \ | ||
# && if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi | ||
# Install CDOGS | ||
COPY . . | ||
RUN npm ci | ||
|
||
# # Install CDOGS | ||
# COPY . . | ||
# RUN npm ci | ||
# EXPOSE 3000 | ||
# CMD ["npm", "run", "start"] | ||
EXPOSE 3000 | ||
CMD ["npm", "run", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
# find where python was installed | ||
encodings_root=$(find /usr/lib/python* -type d -name 'encodings') | ||
python_root=$(dirname $encodings_root) | ||
|
||
mv ${APP_ROOT}/docker/python /usr/lib/libreoffice/program | ||
ln -sf /usr/bin/python3 /usr/lib/libreoffice/program/python.bin | ||
ln -sf ${python_root} /usr/lib/libreoffice/program/python-core | ||
chmod a+rx /usr/lib/libreoffice/program/python | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/sh | ||
# | ||
# This file is part of the LibreOffice project. | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
# | ||
# This file incorporates work covered by the following license notice: | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed | ||
# with this work for additional information regarding copyright | ||
# ownership. The ASF licenses this file to you under the Apache | ||
# License, Version 2.0 (the "License"); you may not use this file | ||
# except in compliance with the License. You may obtain a copy of | ||
# the License at http://www.apache.org/licenses/LICENSE-2.0 . | ||
# | ||
|
||
# resolve installation directory | ||
sd_cwd="`pwd`" | ||
if [ -h "$0" ] ; then | ||
sd_basename=`basename "$0"` | ||
sd_script=`ls -l "$0" | sed "s/.*${sd_basename} -> //g"` | ||
cd "`dirname "$0"`" | ||
cd "`dirname "$sd_script"`" | ||
else | ||
cd "`dirname "$0"`" | ||
fi | ||
sd_prog=`pwd` | ||
cd "$sd_cwd" | ||
|
||
# Set PATH so that crash_report is found: | ||
PATH=$sd_prog${PATH+:$PATH} | ||
export PATH | ||
|
||
# Set UNO_PATH so that "officehelper.bootstrap()" can find soffice executable: | ||
: ${UNO_PATH=$sd_prog} | ||
export UNO_PATH | ||
|
||
# Set URE_BOOTSTRAP so that "uno.getComponentContext()" bootstraps a complete | ||
# OOo UNO environment: | ||
: ${URE_BOOTSTRAP=vnd.sun.star.pathname:$sd_prog/fundamentalrc} | ||
export URE_BOOTSTRAP | ||
|
||
PYTHONPATH=$sd_prog:$sd_prog/python-core/lib:$sd_prog/python-core/lib/lib-dynload:$sd_prog/python-core/lib/lib-tk:$sd_prog/python-core/lib/site-packages${PYTHONPATH+:$PYTHONPATH} | ||
export PYTHONPATH | ||
|
||
# This part doesn't work for some reason and is fine without it | ||
# PYTHONHOME=$sd_prog/python-core | ||
# export PYTHONHOME | ||
|
||
# execute binary | ||
exec "$sd_prog/python.bin" "$@" |