Enoch Jason J commited on
Commit
bd9f042
·
1 Parent(s): b5723ae

Changed Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -15
Dockerfile CHANGED
@@ -5,31 +5,24 @@ FROM python:3.11-slim
5
  WORKDIR /app
6
 
7
  # --- Installation ---
8
- # Copy the local requirements file and the model downloader script
9
  COPY requirements_local.txt .
10
  COPY download_models.py .
11
-
12
- # Install Python dependencies
13
  RUN pip install --no-cache-dir -r requirements_local.txt
14
 
15
- # --- Pre-download and Cache Models during the Build Process ---
16
- # This makes the container startup fast and reliable.
17
- # The token is passed securely as a build argument and is not saved in the final image.
18
- ARG HUGGING_FACE_HUB_TOKEN
 
19
  RUN --mount=type=cache,target=/root/.cache/huggingface \
20
- HUGGING_FACE_HUB_TOKEN=${HUGGING_FACE_HUB_TOKEN} python download_models.py
21
 
22
  # Copy the main application code
23
- COPY app.py .
24
-
25
- # IMPORTANT: If your LoRA adapter is a local folder, you need to copy it in.
26
- # For example:
27
- # COPY ./my_local_lora_adapter /app/my_local_lora_adapter
28
- # Then, in main.py, set LORA_ADAPTER_PATH = "/app/my_local_lora_adapter"
29
 
30
  # Expose the port the app runs on
31
  EXPOSE 8000
32
 
33
  # Command to run the application
34
- CMD ["uvicorn", "app:app", "--host", "0._0.0.0", "--port", "8000"]
35
 
 
5
  WORKDIR /app
6
 
7
  # --- Installation ---
 
8
  COPY requirements_local.txt .
9
  COPY download_models.py .
 
 
10
  RUN pip install --no-cache-dir -r requirements_local.txt
11
 
12
+ # --- Pre-download and Cache Models ---
13
+ # FIX: This RUN command is now simplified.
14
+ # The HUGGING_FACE_HUB_TOKEN is automatically provided as an environment variable
15
+ # by the Hugging Face Spaces secrets manager. The python script will read it directly.
16
+ # The ARG line is no longer needed.
17
  RUN --mount=type=cache,target=/root/.cache/huggingface \
18
+ python download_models.py
19
 
20
  # Copy the main application code
21
+ COPY main.py .
 
 
 
 
 
22
 
23
  # Expose the port the app runs on
24
  EXPOSE 8000
25
 
26
  # Command to run the application
27
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
28