具体需求:
根据Libreoffice最新版本,创建一个容器环境,用于文件不同类型的转换
# 使用阿里云的Python镜像
FROM dockerpull.com/python:3.9-slim
# 设置工作目录
WORKDIR /app
# 更新debian系统的APT源列表为阿里
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get clean && \
echo 'deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib' > /etc/apt/sources.list && \
echo 'deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib' >> /etc/apt/sources.list && \
echo 'deb https://mirrors.aliyun.com/debian-security/ bookworm-security main' >> /etc/apt/sources.list && \
echo 'deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main' >> /etc/apt/sources.list && \
echo 'deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib' >> /etc/apt/sources.list && \
echo 'deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib' >> /etc/apt/sources.list && \
echo 'deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib' >> /etc/apt/sources.list && \
echo 'deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib' >> /etc/apt/sources.list && \
apt-get update
# 安装基础编译环境等依赖
RUN apt-get install -y --no-install-recommends build-essential libeigen3-dev gcc libmariadb-dev && \
rm -rf /var/lib/apt/lists/*
# 安装LibreOffice(使用阿里云的APT源)
RUN apt-get update && \
apt-get install -y --no-install-recommends libreoffice && \
rm -rf /var/lib/apt/lists/*
# 拷贝应用代码, 当前dockerfile所在路径下的所有文件到当前的工作目录中
COPY . .
# 安装Python依赖 根据当前路径下的requirements.txt
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
# 暴露端口
EXPOSE 5000
# 运行主程序
CMD ["sh", "start.sh"]
docker-compose
version: '3'
services:
ppt2pdf_service:
image: ppt2pdf:latest
container_name: ppt2pdf
restart: always
# environment:
# - ENV_VAR_NAME=value
# volumes:
# - ./host/path:/container/path
ports:
- "3690:5000"
networks:
- ppt2pdf_network
networks:
ppt2pdf_network:
driver: bridge
标签:non,aliyun,free,apt,&&,镜像,libreoffice,docker,com
From: https://www.cnblogs.com/mappleyan/p/18406685