Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shantanuo/ab79613016e3e29af7ffb70925c13764 to your computer and use it in GitHub Desktop.
Save shantanuo/ab79613016e3e29af7ffb70925c13764 to your computer and use it in GitHub Desktop.
Running LibrePythonista in linuxserver/libreoffice docker

Running LibrePythonista in linuxserver/libreoffice docker

In order to install LibrePythonista in linuxserver/libreoffice docker (Alpine) image py3-pip must be installed.

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

Steps after docker image is running

  • 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

docker-compose.yml

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

Docker

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

Command

Docker command to build docker image.

docker compose -f 'docker-compose.yml' up -d --build 'linuxserver_app'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment