-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (30 loc) · 1.2 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM python:3.12.6-slim AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# Устанавливаем Poetry
RUN curl -sSL https://install.python-poetry.org | python -
# Добавляем Poetry в PATH
ENV PATH="/root/.local/bin:$PATH"
WORKDIR /app
RUN pip install --upgrade --no-cache-dir pip && pip install pymupdf --no-cache-dir;
COPY pyproject.toml poetry.lock /app/
RUN poetry config virtualenvs.create false && \
poetry install --no-root --only main --no-interaction --no-ansi --no-cache;
FROM python:3.12.6-slim
ENV PYTHONUNBUFFERED=1
RUN addgroup --gid 10001 app \
&& adduser --disabled-password --home /app --uid 10001 --gid 10001 app \
&& chown -R app:app /app;
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Копируем зависимости из builder-этапа
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --chown=app:app . /app
RUN chmod +x run.sh
USER app
EXPOSE 8000
CMD ["/bin/bash", "/app/run.sh"]