Spaces:
Sleeping
Sleeping
优化 Dockerfile 大幅减少镜像体积 (#729)
Browse files- Dockerfile +11 -8
Dockerfile
CHANGED
@@ -1,15 +1,18 @@
|
|
1 |
-
FROM python:3.9 as builder
|
2 |
-
RUN apt-get update
|
|
|
|
|
|
|
3 |
COPY requirements.txt .
|
4 |
COPY requirements_advanced.txt .
|
5 |
-
RUN pip install --user -r requirements.txt
|
6 |
-
# RUN pip install --user -r requirements_advanced.txt
|
7 |
|
8 |
-
FROM python:3.9
|
9 |
-
|
10 |
COPY --from=builder /root/.local /root/.local
|
11 |
ENV PATH=/root/.local/bin:$PATH
|
12 |
COPY . /app
|
13 |
WORKDIR /app
|
14 |
-
ENV dockerrun
|
15 |
-
CMD ["python3", "-u", "ChuanhuChatbot.py",
|
|
|
1 |
+
FROM python:3.9-slim-buster as builder
|
2 |
+
RUN apt-get update \
|
3 |
+
&& apt-get install -y build-essential \
|
4 |
+
&& apt-get clean \
|
5 |
+
&& rm -rf /var/lib/apt/lists/*
|
6 |
COPY requirements.txt .
|
7 |
COPY requirements_advanced.txt .
|
8 |
+
RUN pip install --user --no-cache-dir -r requirements.txt
|
9 |
+
# RUN pip install --user --no-cache-dir -r requirements_advanced.txt
|
10 |
|
11 |
+
FROM python:3.9-slim-buster
|
12 |
+
LABEL maintainer="iskoldt"
|
13 |
COPY --from=builder /root/.local /root/.local
|
14 |
ENV PATH=/root/.local/bin:$PATH
|
15 |
COPY . /app
|
16 |
WORKDIR /app
|
17 |
+
ENV dockerrun=yes
|
18 |
+
CMD ["python3", "-u", "ChuanhuChatbot.py","2>&1", "|", "tee", "/var/log/application.log"]
|