File size: 1,199 Bytes
4ff5731
 
ff17fc2
4ff5731
 
a566642
4ff5731
a566642
efa9503
4ff5731
 
 
efa9503
6bfa8ee
4ff5731
efa9503
4ff5731
 
ff17fc2
 
 
 
 
 
 
4ff5731
 
 
ff17fc2
4ff5731
ff17fc2
 
 
 
 
 
 
 
 
 
a566642
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 NVIDIA's CUDA base image with Python
FROM nvidia/cuda:11.8.0-runtime-ubuntu20.04

# Set environment variables
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH="/home/user/.local/bin:$PATH"

# Install Python, pip, and other dependencies
RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    python3-dev \
    libgl1-mesa-glx \
    libglib2.0-0 \  # Required for GLib
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# Create a non-root user
RUN useradd -m user

# Set the user to the non-root user
USER user

# Set the working directory to /app
WORKDIR /app

# Copy the requirements.txt file and install dependencies
COPY --chown=user requirements.txt /app/requirements.txt
RUN pip3 install --no-cache-dir --upgrade -r /app/requirements.txt

# Copy the application code into the container
COPY --chown=user . /app

# Create the folders for uploads and results with appropriate permissions
RUN mkdir -p /app/static/uploads /app/static/results && \
    chmod -R 755 /app/static/uploads /app/static/results

# Expose the port the app will run on
EXPOSE 7860

# Run the Flask app using uvicorn
CMD ["python3", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]