Update Dockerfile
Browse files- Dockerfile +8 -12
Dockerfile
CHANGED
|
@@ -5,12 +5,15 @@ FROM python:3.9-slim
|
|
| 5 |
ENV PYTHONDONTWRITEBYTECODE 1
|
| 6 |
ENV PYTHONUNBUFFERED 1
|
| 7 |
|
| 8 |
-
|
| 9 |
WORKDIR /code
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Install Python dependencies
|
| 16 |
COPY requirements.txt .
|
|
@@ -18,18 +21,11 @@ RUN pip install --no-cache-dir --upgrade pip && \
|
|
| 18 |
pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
| 20 |
# Copy the rest of the application code into the container
|
| 21 |
-
# Copy app directory first
|
| 22 |
COPY ./app /code/app
|
| 23 |
-
# Copy static files
|
| 24 |
COPY ./static /code/static
|
| 25 |
-
# Copy index.html
|
| 26 |
COPY ./index.html /code/index.html
|
| 27 |
|
| 28 |
-
|
| 29 |
-
# Expose the port the app runs on
|
| 30 |
-
# Hugging Face Spaces will map this port (default is 7860, but we use 8000 here)
|
| 31 |
EXPOSE 7860
|
| 32 |
|
| 33 |
-
|
| 34 |
-
# Use 0.0.0.0 to make it accessible from outside the container
|
| 35 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 5 |
ENV PYTHONDONTWRITEBYTECODE 1
|
| 6 |
ENV PYTHONUNBUFFERED 1
|
| 7 |
|
| 8 |
+
|
| 9 |
WORKDIR /code
|
| 10 |
|
| 11 |
+
|
| 12 |
+
ENV HF_HOME=/code/huggingface_cache
|
| 13 |
+
|
| 14 |
+
RUN mkdir -p $HF_HOME && \
|
| 15 |
+
chmod -R 777 $HF_HOME
|
| 16 |
+
|
| 17 |
|
| 18 |
# Install Python dependencies
|
| 19 |
COPY requirements.txt .
|
|
|
|
| 21 |
pip install --no-cache-dir -r requirements.txt
|
| 22 |
|
| 23 |
# Copy the rest of the application code into the container
|
|
|
|
| 24 |
COPY ./app /code/app
|
|
|
|
| 25 |
COPY ./static /code/static
|
|
|
|
| 26 |
COPY ./index.html /code/index.html
|
| 27 |
|
|
|
|
|
|
|
|
|
|
| 28 |
EXPOSE 7860
|
| 29 |
|
| 30 |
+
|
|
|
|
| 31 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|