kouki321 commited on
Commit
7ddc2f8
·
verified ·
1 Parent(s): c1e79d1

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -12
Dockerfile CHANGED
@@ -1,20 +1,28 @@
1
- # Use an official Python runtime as a parent image
2
  FROM python:3.10-slim
3
 
4
- # Set working directory in container
5
- WORKDIR /app
6
-
7
- # Copy requirements if you have them
8
- COPY requirements.txt ./
9
-
10
  # Install dependencies
 
 
 
 
 
 
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
- # Copy the rest of your code
14
- COPY . .
 
 
 
 
 
 
 
 
15
 
16
- # Expose port (default for Gradio)
17
  EXPOSE 7860
18
 
19
- # Command to run your app
20
- CMD ["python", "app.py"]
 
1
+ # Use a slim base image
2
  FROM python:3.10-slim
3
 
 
 
 
 
 
 
4
  # Install dependencies
5
+ RUN apt-get update && \
6
+ apt-get install -y git && \
7
+ rm -rf /var/lib/apt/lists/*
8
+
9
+ # Optional: copy requirements file and install
10
+ COPY requirements.txt .
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
+ # Copy your app code into the container
14
+ WORKDIR /app
15
+ COPY app.py /app/app.py
16
+
17
+ # Create a writable cache directory
18
+ RUN mkdir -p /app/cache
19
+
20
+ # Set environment variables for cache and disable root cache attempts
21
+ ENV TRANSFORMERS_CACHE=/app/cache
22
+ ENV HF_HOME=/app/cache
23
 
24
+ # Expose port (for Gradio/Streamlit etc.)
25
  EXPOSE 7860
26
 
27
+ # Launch your app
28
+ CMD ["python", "app.py"]