File size: 1,175 Bytes
ac44feb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use an official Python runtime as a parent image
FROM python:3.10-slim

# Include a label to identify the image
LABEL maintainer="AI MedScan Platform"

# Set the working directory in the container
WORKDIR /app

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# Disable oneDNN warnings and ensure TF uses CPU optimally
ENV TF_ENABLE_ONEDNN_OPTS=0
ENV PORT=7860

# Install essential system dependencies (if using regular OpenCV, else headless is fine)
RUN apt-get update && apt-get install -y \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Copy the requirements file first to leverage Docker cache
COPY backend/requirements.txt /app/backend/

# Install python dependencies
RUN pip install --upgrade pip && \
    pip install --no-cache-dir -r backend/requirements.txt

# Copy the rest of the application files to the container
# This includes both the /backend and /frontend directories
COPY . /app/

# Expose the API port
EXPOSE 7860

# Change working directory so uvicorn can resolve "app.main:app"
WORKDIR /app/backend

# Command to run the application
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT}"]