rob-luke / emails-html-to-pdf

Convert emails without attachments to pdf and send as email
32 stars 7 forks source link

Moved from Windows/WSL/Ubuntu to RPi 4b Ubuntu 64 and container fails on startup #22

Closed smseidl closed 2 years ago

smseidl commented 2 years ago

It's not producing much error details only: email2pdf | standard_init_linux.go:228: exec user process caused: exec format error

My compose section:

  email2pdf:
    image: ghcr.io/rob-luke/emails-html-to-pdf:latest
    container_name: email2pdf
    environment:
      - IMAP_URL=xxxx
      - IMAP_USERNAME=xxxx
      - IMAP_PASSWORD=xxxx
      - IMAP_FOLDER=paperless
      - SMTP_URL=xxxx
      - MAIL_SENDER=xxxx
      - MAIL_DESTINATION=xxxx
      - INTER_RUN_INTERVAL=300
      - PRINT_FAILED_MSG='false'
rob-luke commented 2 years ago

Initially I thought it might be something to do with https://stackoverflow.com/questions/42494853/standard-init-linux-go178-exec-user-process-caused-exec-format-error but I checked and the runner.sh file has a #!. I will keep digging.

What happens if you pin to an earlier version rather than latest?

smseidl commented 2 years ago

Still getting below when I reference v0.1.0. I don't think there are other tags to use. I was reading that same post last night... is the problem that you haven't built the ARM/AMD version that matches RPi 4? See lower answer in that post here

Creating network "paperless_default" with the default driver Creating email2pdf ... done Attaching to email2pdf email2pdf | standard_init_linux.go:228: exec user process caused: exec format error email2pdf exited with code 1

smseidl commented 2 years ago

I've tried to build locally, and am getting errors with the apt install of wkhtmltox. I can't seem to find the right architecture

smseidl commented 2 years ago

I may have gotten it working today on my Pi 4B. Here is the Dockerfile I needed to use. I'm not sure how you'd add this into your master. I'm going to have this running for a while and will update here with my findings.

FROM python:3.9-slim

RUN apt-get update && apt-get -y install wget
RUN wget http://ports.ubuntu.com/pool/main/libj/libjpeg-turbo/libjpeg-turbo8_2.0.3-0ubuntu1.20.04.1_arm64.deb
RUN apt-get install ./libjpeg-turbo8_2.0.3-0ubuntu1.20.04.1_arm64.deb
RUN wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_arm64.deb
RUN apt-get install -y ./wkhtmltox_0.12.6-1.focal_arm64.deb
RUN rm -rf /var/lib/apt/lists/* && rm wkhtmltox_0.12.6-1.focal_arm64.deb && rm libjpeg-turbo8_2.0.3-0ubuntu1.20.04.1_arm64.deb

ENV PYTHONPATH=${PYTHONPATH}:${PWD}
RUN pip3 install poetry

RUN mkdir /app
COPY /src /app
COPY pyproject.toml /app
COPY runner.sh /app/runner.sh
RUN chmod +x /app/runner.sh
WORKDIR /app

RUN poetry config virtualenvs.create false
RUN poetry install --no-dev

ENTRYPOINT ["/app/runner.sh"]