File size: 1,209 Bytes
5fc6e5d
 
3cf040e
 
 
 
 
 
5fc6e5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.12

# Set environment variable
ARG MLFLOW_TRACKING_USERNAME
ARG MLFLOW_TRACKING_PASSWORD
ARG DAGSHUB_USER_TOKEN


# Create a non-root user to run the application and set permissions
RUN useradd -m -u 1000 turinguser
RUN mkdir -p /app/models && chown -R turinguser:turinguser /app /app/models
USER turinguser

# Set environment variables 
# PATH to include local user binaries and project root
ENV PATH="/home/turinguser/.local/bin:$PATH"
ENV PROJ_ROOT=/app

# Set the working directory in the container
WORKDIR /app

# Copy essential files to install dependencies
COPY --chown=turinguser requirements.txt .

# Install Python dependencies
RUN pip install --default-timeout=1000 --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
RUN pip3 install -v -r requirements.txt --upgrade --default-timeout=1000 --no-cache-dir --break-system-packages

# Copy remaining project files
COPY --chown=turinguser turing ./turing
COPY --chown=turinguser reports ./reports

# Expose port 7860 for the FastAPI application
EXPOSE 7860

# Default command to run the FastAPI application on port 7860
CMD ["uvicorn", "turing.api.app:app", "--host", "0.0.0.0", "--port", "7860"]