-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
32 lines (22 loc) · 863 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
FROM python:3.11-slim AS poetry
ENV PATH "/root/.local/bin:${PATH}"
ENV PYTHONUNBUFFERED 1
WORKDIR /root
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update && \
apt-get install curl -y --no-install-recommends && \
curl -sSL https://install.python-poetry.org | python -
COPY poetry.lock pyproject.toml ./
RUN poetry export --no-interaction -o requirements.txt --without-hashes --only main,docker
FROM python:3.11-slim AS base
ENV PYTHONPATH "/app"
WORKDIR /app
RUN groupadd -g 5000 container && useradd -d /app -m -g container -u 5000 container
COPY --from=poetry /root/requirements.txt ./
RUN pip --no-cache-dir install -U pip && \
pip --no-cache-dir install -r requirements.txt
COPY src/ src/
FROM base AS final
RUN chown -R 5000:5000 /app
USER container
CMD ["dumb-init", "python", "-m", "src"]