无法在 Dockerfile 中找到用于安装 Weasyprint PDF 生成器的包 libpango1.0-0

无法在 Dockerfile 中找到用于安装 Weasyprint PDF 生成器的包 libpango1.0-0

我有一个生成 PDF 的 Python 脚本。它使用 Wea​​syprint 生成 PDF。我已设法使用 Dockerfile 构建脚本,直到 2024 年 4 月 26 日。当时包发生了一些变化libpango1.0-0

这是我的 Dockerfile:

# Specify Python
FROM ubuntu:latest



# Upgrade Ubuntu
RUN echo Dockerfile :: Update Ubuntu
RUN apt-get update && apt-get install -y
RUN apt-get install build-essential -y


# Install Python
RUN echo Dockerfile :: Install Python
RUN apt install python3 -y
RUN python3 --version


# Install Weasyprint
RUN echo Dockerfile :: Install components
RUN apt-get install -y python3-lxml libcairo2 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info
RUN apt-get install -y libpango1.0-0
RUN apt install -y python3-dev libpq-dev

# Install PIP
RUN echo Dockerfile :: Install PIP
RUN apt-get install python3-pip -y
RUN pip --version

# Set enviroment variables
RUN echo Dockerfile :: Set enviroment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Open port
RUN echo Dockerfile :: Open port
EXPOSE 8080

# Add Python script
RUN echo Dockerfile :: Add Python script
RUN mkdir /app
WORKDIR /app
COPY . .

# Install dependencies
RUN echo Dockerfile :: Install dependencies
RUN pip install -r requirements.txt

# Set Pythons path
RUN echo Dockerfile :: Set Pythons path
ENV PYTHONPATH /app

# Run script
RUN echo Dockerfile :: Run script
CMD [ "python3", "./main.py" ]

我收到的错误是:

Step #0 - "Build": E: Unable to locate package libpango1.0-0
Step #0 - "Build": E: Couldn't find any package by glob 'libpango1.0-0'
Step #0 - "Build": E: Couldn't find any package by regex 'libpango1.0-0'
Step #0 - "Build": The command '/bin/sh -c apt-get install -y libpango1.0-0' returned a non-zero code: 100

我尝试添加以下内容,但仍然出现相同的错误:

RUN apt-get clean
RUN apt-get -f install
RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get dist-upgrade

相关内容