File size: 1,542 Bytes
6d69370
 
df8bb52
 
6d69370
df8bb52
 
6d69370
 
 
 
 
 
df8bb52
6d69370
 
 
 
 
 
 
 
8aa15e7
6d69370
 
df8bb52
6d69370
 
 
df8bb52
6d69370
 
 
 
 
 
 
f142339
df8bb52
 
 
6d69370
 
df8bb52
 
 
 
 
 
 
 
 
 
 
 
6d69370
df8bb52
6d69370
 
 
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Use an NVIDIA CUDA base image
ARG CUDA_IMAGE="12.1.1-cudnn8-devel-ubuntu22.04"
FROM nvidia/cuda:${CUDA_IMAGE}


ENV HOST 0.0.0.0

# Set the working directory in the container to /app
#WORKDIR /app

RUN mkdir -p /app/cache && chmod -R 777 /app/cache

ENV HF_HOME=/app/cache

# Install Python and pip
RUN apt-get update && apt-get install --no-install-recommends -y \
  build-essential \
  python3.9 \
  python3-pip \
  git \
  ffmpeg \
  && apt-get clean && rm -rf /var/lib/apt/lists/*

# Copy the current directory contents into the container at /app
COPY . /app

# Install required packages from requirements.txt
COPY ./requirements.txt /app/requirements.txt
RUN pip3 install --no-cache-dir -r /app/requirements.txt

# Expose the ports for FastAPI and Streamlit
EXPOSE 8000
EXPOSE 8501

# Copy and give execute permissions to the start script
COPY start_server.sh /app/start_server.sh
RUN chmod +x /app/start_server.sh

RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user

WORKDIR /home/user/app
# Set home to the user's home directory
ENV HOME=/home/user \
	PATH=/home/user/.local/bin:$PATH \
    PYTHONPATH=$HOME/app \
	PYTHONUNBUFFERED=1 \
	GRADIO_ALLOW_FLAGGING=never \
	GRADIO_NUM_PORTS=1 \
	GRADIO_SERVER_NAME=0.0.0.0 \
	GRADIO_THEME=huggingface \
	SYSTEM=spaces

# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . /home/user/app

# Run the start script
#CMD ["/app/start_server.sh"]
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]