Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +34 -0
Dockerfile
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.10
|
3 |
+
|
4 |
+
# Set the working directory in the container
|
5 |
+
WORKDIR /code
|
6 |
+
|
7 |
+
# Copy the requirements file into the container
|
8 |
+
COPY ./requirements.txt /code/requirements.txt
|
9 |
+
|
10 |
+
# Install any needed dependencies
|
11 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
12 |
+
|
13 |
+
# Install gradio
|
14 |
+
RUN pip install gradio
|
15 |
+
|
16 |
+
# Set the TRANSFORMERS_CACHE environment variable
|
17 |
+
ENV TRANSFORMERS_CACHE /temp
|
18 |
+
ENV FILES /temp_files
|
19 |
+
|
20 |
+
# Create the cache directory and adjust permissions
|
21 |
+
RUN mkdir -p $TRANSFORMERS_CACHE \
|
22 |
+
&& chmod -R 777 $TRANSFORMERS_CACHE
|
23 |
+
|
24 |
+
RUN mkdir -p $FILES \
|
25 |
+
&& chmod -R 777 $FILES
|
26 |
+
|
27 |
+
# Copy the rest of the application code into the container
|
28 |
+
COPY . .
|
29 |
+
|
30 |
+
# Expose the port that the FastAPI application will run on
|
31 |
+
EXPOSE 7860
|
32 |
+
|
33 |
+
# Command to run the FastAPI application with Gradio
|
34 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|