In order to install LibrePythonista in linuxserver/libreoffice docker (Alpine) image py3-pip
must be installed.
The other packages are required to install matplotlib.
Create a docker
and a docker-compose.yml
files and place them in the same folder.
Use the contents from the examples below.
Note that volumes are optional. If you want to follow this yml
file on Linux or Mac then create a folder in your home folder named vm_shared
and that folder will be shared with you docker image.
volumes:
- ~/vm_shared:/vm_shared # Mount ~/vm_shared to /vm_shared inside the container
- Set LibreOffice Macro Security to Medium
- Install LibrePythonista Extension into LibreOffice - restart when prompted
- On Restart LibrePythonista will install dependencies.
- After dependencies are install restart LibreOffice one more time. At this point Extension should be working.
Note: The experimental python editor will not work in this configuration. Currently the editor depends on pywebview and I have not yet figured out how to get this working in this Alpine image.
To see the contents of the log file start a terminal and run:
cat /config/.config/libreoffice/4/user/libre_pythonista.log
The contents of docker-compose.yml
services:
linuxserver_app:
network_mode: "bridge"
build:
dockerfile: Dockerfile
# user: root
container_name: linuxserver_container
security_opt:
- seccomp:unconfined #optional
environment:
- TZ=Etc/UTC
- PUID=1000
- PGID=1000
ports:
- 3000:3000
- 3001:3001
restart: unless-stopped
volumes:
- ~/vm_shared:/vm_shared # Mount ~/vm_shared to /vm_shared inside the container
The contents of docker
file
FROM linuxserver/libreoffice:latest
RUN apk update \
&& apk add --no-cache --update py3-pip \
gcc \
g++ \
musl-dev \
python3-dev \
freetype-dev \
libpng-dev pkgconfig
# Securty to prevent sudo actions
RUN > /etc/sudoers.d/wheel
This command will disable sudo access, thereby preventing users from unintentionally shutting down the container or executing privileged commands.
RUN > /etc/sudoers.d/wheel
Or you can add this code to your Dockerfile to disable shell completely:
RUN for user in $(cut -d: -f1 /etc/passwd); do \
usermod -s /usr/sbin/nologin "$user"; \
done
See Also: Amourspirit/python_libre_pythonista_ext#69 (comment)
Docker command to build docker image.
docker compose -f 'docker-compose.yml' up -d --build 'linuxserver_app'