File size: 1,165 Bytes
f7d11f7
 
 
 
 
 
 
 
 
 
94dd802
f7d11f7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94dd802
f7d11f7
c0ba94e
 
f7d11f7
 
 
5626843
a21b3e8
5626843
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
FROM python:3.11.9-slim-bookworm

# avoid creating unnecessary .pyc, buffers, and pip caches
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PIP_NO_CACHE_DIR=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1

# install curl and certificates needed to install uv
RUN apt-get update && apt-get install -y --no-install-recommends \
    curl ca-certificates git \
    && rm -rf /var/lib/apt/lists/*

# create a non-root user for added security
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

WORKDIR /cardioTrack

# install uv as user
RUN curl -LsSf https://astral.sh/uv/install.sh | sh

# copy the project files and do uv sync
COPY --chown=user pyproject.toml uv.lock ./
RUN uv sync --locked --no-install-project

# copy the rest of the files needed for inference
COPY --chown=user . .

RUN sed -i 's/\r$//' predicting_outcomes_in_heart_failure/app/entrypoint.sh \
    && chmod +x predicting_outcomes_in_heart_failure/app/entrypoint.sh

EXPOSE 7860

ENTRYPOINT ["predicting_outcomes_in_heart_failure/app/entrypoint.sh"]

CMD ["uv", "run", "uvicorn", "predicting_outcomes_in_heart_failure.app.main:app", "--host", "0.0.0.0", "--port", "7860"]