gpt4 book ai didi

amazon-web-services - Libreoffice 转换为在 AWS docker 镜像中不起作用

转载 作者:行者123 更新时间:2023-12-04 19:39:31 30 4
gpt4 key购买 nike

我尝试使用 libreoffice 将文件转换为 pdf,目前我取得的最好成绩是:

RUN wget http://download.documentfoundation.org/libreoffice/stable/7.2.5/rpm/x86_64/LibreOffice_7.2.5_Linux_x86-64_rpm.tar.gz
RUN tar -xvzf LibreOffice_7.2.5_Linux_x86-64_rpm.tar.gz
RUN cd LibreOffice_7.2.5.2_Linux_x86-64_rpm/RPMS; yum -y localinstall *.rpm;
RUN yum -y install cairo
RUN echo instalacion completada
RUN /opt/libreoffice7.2/program/soffice.bin --version
直到这里,工作!显示正确安装的 libreoffice 版本,但尝试运行时,它不起作用:
RUN /opt/libreoffice7.2/program/soffice.bin --headless --convert-to pdf my_file.xlsm
返回:

The command '/bin/sh -c /opt/libreoffice7.2/program/soffice.bin--headless --convert-to pdf my_file.xlsm' returned a non-zero code: 81


我完整的 Dockerfile
# Pull the base image with python 3.8 as a runtime for your Lambda
FROM public.ecr.aws/lambda/python:3.8

RUN mkdir experimento/
COPY my_file.xlsm .

# Install OS packages for Pillow-SIMD
RUN yum -y install wget tar gzip zlib freetype-devel \
gcc \
ghostscript \
lcms2-devel \
libffi-devel \
libimagequant-devel \
libjpeg-devel \
libraqm-devel \
libtiff-devel \
libwebp-devel \
make \
openjpeg2-devel \
rh-python36 \
rh-python36-python-virtualenv \
sudo \
tcl-devel \
tk-devel \
tkinter \
which \
xorg-x11-server-Xvfb \
zlib-devel \
&& yum clean all

RUN wget http://download.documentfoundation.org/libreoffice/stable/7.2.5/rpm/x86_64/LibreOffice_7.2.5_Linux_x86-64_rpm.tar.gz
RUN tar -xvzf LibreOffice_7.2.5_Linux_x86-64_rpm.tar.gz
RUN cd LibreOffice_7.2.5.2_Linux_x86-64_rpm/RPMS; yum -y localinstall *.rpm;
RUN yum -y install cairo
RUN echo instalacion completada
RUN /opt/libreoffice7.2/program/soffice.bin --version
RUN /opt/libreoffice7.2/program/soffice.bin -h
RUN sudo find / -name soffice.bin
RUN yum install -y libXinerama.x86_64 cups-libs dbus-glib
RUN sudo /opt/libreoffice7.2/program/soffice.bin --headless --invisible --nodefault --nofirststartwizard --nolockcheck --nologo --norestore --convert-to 'pdf:writer_pdf_Export' --outdir experimento/ my_file.xlsm

最佳答案

我找到了解决办法,问题是.binsoffice 结尾:

# Pull the base image with python 3.8 as a runtime for your Lambda
FROM public.ecr.aws/lambda/python:3.8

COPY my_file.xlsm .

# Install OS packages for Pillow-SIMD
RUN yum -y install curl wget tar gzip zlib freetype-devel \
libxslt \
libxslt1-dev \
gcc \
ghostscript \
lcms2-devel \
libffi-devel \
libimagequant-devel \
libjpeg-devel \
libraqm-devel \
libtiff-devel \
libwebp-devel \
make \
openjpeg2-devel \
rh-python36 \
rh-python36-python-virtualenv \
sudo \
tcl-devel \
tk-devel \
tkinter \
which \
xorg-x11-server-Xvfb \
zlib-devel \
java \
&& yum clean all

RUN wget http://download.documentfoundation.org/libreoffice/stable/7.2.5/rpm/x86_64/LibreOffice_7.2.5_Linux_x86-64_rpm.tar.gz
RUN tar -xvzf LibreOffice_7.2.5_Linux_x86-64_rpm.tar.gz
RUN cd LibreOffice_7.2.5.2_Linux_x86-64_rpm/RPMS; yum -y localinstall *.rpm;
RUN yum -y install cairo
RUN /opt/libreoffice7.2/program/soffice.bin --version
COPY carta_2020.xlsm /tmp/
RUN ls /tmp/
RUN /opt/libreoffice7.2/program/soffice --headless --convert-to pdf --outdir /tmp my_file.xlsm

关于amazon-web-services - Libreoffice 转换为在 AWS docker 镜像中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70945630/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com