File size: 1,098 Bytes
6a810cb
 
 
 
 
 
 
 
2c4a5b7
 
 
6a810cb
 
2c4a5b7
6a810cb
 
2c4a5b7
 
 
6a810cb
 
2c4a5b7
6a810cb
80ea012
6a810cb
 
2c4a5b7
 
6a810cb
 
 
 
80ea012
 
01402bf
 
6a810cb
 
 
 
 
 
 
 
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
# Use an official Python runtime as a parent image
FROM python:3.10

# Set the working directory in the container
WORKDIR /code

# Copy the requirements file into the container
COPY ./requirements.txt /code/requirements.txt
COPY ./packages.txt /code/packages.txt



# Install any needed dependencies
RUN apt-get update && apt-get install -y sudo $(cat packages.txt)
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# Install fastapi
RUN pip install fastapi 
RUN pip install "uvicorn[standard]"

# Set the TRANSFORMERS_CACHE environment variable
ENV TEMP_FILES /temp
ENV FILES /temp_files
ENV CACHE /.cache

# Create the cache directory and adjust permissions
RUN mkdir -p $TEMP_FILES \
    && chmod -R 777 $TEMP_FILES

RUN mkdir -p $FILES \
    && chmod -R 777 $FILES

RUN mkdir -p $CACHE \
    && chmod -R 777 $CACHE


# Copy the rest of the application code into the container
COPY . .

# Expose the port that the FastAPI application will run on
EXPOSE 7860

# Command to run the FastAPI application with Gradio
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]