@@ -2,53 +2,49 @@ FROM python:3.10-slim
22
33ARG PANDOC_ARCH=amd64
44ENV PANDOC_ARCH=$PANDOC_ARCH
5+ ENV PATH="${PATH}:/root/.local/bin"
56
67WORKDIR /app
78
8- RUN echo \
9- deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib \
10- deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib \
11- deb https://mirrors.aliyun.com/debian-security/ bookworm-security main \
12- deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main \
13- deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib \
14- deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib \
15- deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib \
16- deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib \
17- > /etc/apt/sources.list
18-
19-
20-
21- # Install lib
22- RUN apt-get update && apt-get install gcc g++ curl build-essential postgresql-server-dev-all wget libreoffice -y
23- RUN apt-get update && apt-get install procps -y
24-
25- # Install pandoc
26- RUN mkdir -p /opt/pandoc \
27- && cd /opt/pandoc \
28- && wget https://github.com/jgm/pandoc/releases/download/3.6.4/pandoc-3.6.4-linux-${PANDOC_ARCH}.tar.gz \
29- && tar xvf pandoc-3.6.4-linux-${PANDOC_ARCH}.tar.gz \
30- && cd pandoc-3.6.4 \
31- && cp bin/pandoc /usr/bin/ \
32- && cd ..
33-
34- # Install font
35- RUN apt install vim fonts-wqy-zenhei -y
36- # opencv
37- RUN apt-get update && apt-get install -y libglib2.0-0 libsm6 libxrender1 libxext6 libgl1
9+ # 使用国内源 + 安装依赖(合并指令、清理缓存、禁用推荐包)
10+ RUN echo "\
11+ deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib\n \
12+ deb https://mirrors.aliyun.com/debian-security/ bookworm-security main\n \
13+ deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib\n \
14+ deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib" \
15+ > /etc/apt/sources.list && \
16+ apt-get update && \
17+ apt-get install -y --no-install-recommends \
18+ gcc g++ curl build-essential postgresql-server-dev-all libreoffice \
19+ wget procps vim fonts-wqy-zenhei \
20+ libglib2.0-0 libsm6 libxrender1 libxext6 libgl1 \
21+ && rm -rf /var/lib/apt/lists/*
22+
23+
24+ # 安装 pandoc
25+ RUN mkdir -p /opt/pandoc && \
26+ cd /opt/pandoc && \
27+ wget https://github.com/jgm/pandoc/releases/download/3.6.4/pandoc-3.6.4-linux-${PANDOC_ARCH}.tar.gz && \
28+ tar xvf pandoc-3.6.4-linux-${PANDOC_ARCH}.tar.gz && \
29+ cp pandoc-3.6.4/bin/pandoc /usr/bin/ && \
30+ rm -rf /opt/pandoc
31+
32+ # 安装 Poetry
3833RUN curl -sSL https://install.python-poetry.org | python3 - --version 1.8.2
39- # # Add Poetry to PATH
40- ENV PATH="${PATH}:/root/.local/bin"
4134
35+ # 拷贝项目依赖文件
4236COPY ./pyproject.toml ./
4337
38+ # 安装 Python 依赖
4439RUN python -m pip install --upgrade pip && \
45- pip install shapely==2.0.1
40+ pip install shapely==2.0.1 && \
41+ poetry config virtualenvs.create false && \
42+ poetry install --no-interaction --no-ansi --without dev
43+
44+ # 安装 NLTK 数据
45+ RUN python -c "import nltk; nltk.download('punkt'); nltk.download('punkt_tab'); nltk.download('averaged_perceptron_tagger'); nltk.download('averaged_perceptron_tagger_eng')"
4646
47- # Install dependencies
48- RUN poetry config virtualenvs.create false
49- RUN poetry install --no-interaction --no-ansi --without dev
47+ COPY . .
5048
51- # install nltk_data
52- RUN python -c "import nltk; nltk.download('punkt'); nltk.download('punkt_tab'); nltk.download('averaged_perceptron_tagger'); nltk.download('averaged_perceptron_tagger_eng'); "
49+ CMD ["sh" , "entrypoint.sh" ]
5350
54- CMD ["sh entrypoint.sh" ]
0 commit comments