Update Dockerfile
Browse files- Dockerfile +4 -21
Dockerfile
CHANGED
@@ -1,30 +1,13 @@
|
|
1 |
-
# Use the official Python image from the Docker Hub
|
2 |
FROM python:3.9
|
3 |
|
4 |
RUN useradd -m -u 1000 user
|
5 |
USER user
|
6 |
ENV PATH="/home/user/.local/bin:$PATH"
|
7 |
|
8 |
-
|
9 |
-
# Set the working directory in the container
|
10 |
WORKDIR /app
|
11 |
|
12 |
-
|
13 |
-
RUN
|
14 |
-
apt-get install -y git && \
|
15 |
-
pip install --no-cache-dir fastapi uvicorn transformers torch python-dotenv
|
16 |
-
|
17 |
-
# Create cache directory and set environment variables
|
18 |
-
RUN mkdir -p /app/cache
|
19 |
-
ENV HF_HOME=/app/cache
|
20 |
-
RUN chmod -R 777 /app/cache
|
21 |
-
|
22 |
-
|
23 |
-
# Copy the current directory contents into the container at /app
|
24 |
-
COPY . /app
|
25 |
-
|
26 |
-
# Expose port 8000
|
27 |
-
EXPOSE 8000
|
28 |
|
29 |
-
|
30 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
1 |
FROM python:3.9
|
2 |
|
3 |
RUN useradd -m -u 1000 user
|
4 |
USER user
|
5 |
ENV PATH="/home/user/.local/bin:$PATH"
|
6 |
|
|
|
|
|
7 |
WORKDIR /app
|
8 |
|
9 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
10 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
+
COPY --chown=user . /app
|
13 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|