-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
34 lines (21 loc) · 913 Bytes
/
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
FROM python:3.12-slim AS builder
WORKDIR /app
RUN echo "deb http://deb.debian.org/debian/ stable main contrib non-free" > /etc/apt/sources.list && \
apt-get update && \
apt-get install -y --no-install-recommends libjemalloc2 git && \
rm -rf /var/lib/apt/lists/*
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2
RUN pip install --no-cache-dir poetry && poetry config virtualenvs.create false
RUN poetry --version
COPY pyproject.toml poetry.lock ./
RUN if [ ! -f poetry.lock ]; then poetry lock; fi
RUN poetry install --no-root --no-interaction
FROM python:3.12-slim
WORKDIR /app
RUN echo "deb http://deb.debian.org/debian/ stable main contrib non-free" > /etc/apt/sources.list && \
apt-get update && \
apt-get install -y --no-install-recommends libjemalloc2 && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local /usr/local
COPY . .
CMD ["python", "main.py"]