fix: cache and tensorflow
Browse files- Dockerfile +16 -0
- requirements.txt +2 -1
Dockerfile
CHANGED
@@ -1,7 +1,23 @@
|
|
1 |
FROM python:3.9
|
|
|
|
|
2 |
WORKDIR /code
|
|
|
|
|
3 |
COPY ./requirements.txt /code/requirements.txt
|
4 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
|
|
|
|
5 |
COPY ./app /code/app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
EXPOSE 7860
|
|
|
|
|
7 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
FROM python:3.9
|
2 |
+
|
3 |
+
# Set work directory
|
4 |
WORKDIR /code
|
5 |
+
|
6 |
+
# Install dependencies
|
7 |
COPY ./requirements.txt /code/requirements.txt
|
8 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
9 |
+
|
10 |
+
# Copy application code
|
11 |
COPY ./app /code/app
|
12 |
+
|
13 |
+
# Create and set permissions for the cache directory
|
14 |
+
RUN mkdir -p /code/app/cache && chmod -R 777 /code/app/cache
|
15 |
+
|
16 |
+
# Set environment variable for Transformers cache
|
17 |
+
ENV TRANSFORMERS_CACHE=/code/app/cache
|
18 |
+
|
19 |
+
# Expose port
|
20 |
EXPOSE 7860
|
21 |
+
|
22 |
+
# Start application
|
23 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
requirements.txt
CHANGED
@@ -2,4 +2,5 @@ fastapi>=0.68.0,<0.69.0
|
|
2 |
pydantic>=1.8.0,<2.0.0
|
3 |
uvicorn>=0.15.0,<0.16.0
|
4 |
aiofiles==23.2.1
|
5 |
-
transformers
|
|
|
|
2 |
pydantic>=1.8.0,<2.0.0
|
3 |
uvicorn>=0.15.0,<0.16.0
|
4 |
aiofiles==23.2.1
|
5 |
+
transformers
|
6 |
+
tensorflow
|