mike23415 commited on
Commit
6a0670c
·
verified ·
1 Parent(s): a885833

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -4
Dockerfile CHANGED
@@ -1,14 +1,28 @@
 
1
  FROM python:3.9
2
 
 
3
  WORKDIR /app
4
 
 
 
 
 
 
 
 
 
 
 
5
  COPY requirements.txt requirements.txt
 
6
  RUN pip install --no-cache-dir -r requirements.txt
7
 
8
- # Create a cache directory and download the model
9
- RUN mkdir -p /app/cache && \
10
- HF_HOME=/app/cache python -c "from transformers import AutoModelForSeq2SeqLM; AutoModelForSeq2SeqLM.from_pretrained('t5-base')"
11
-
12
  COPY . .
13
 
 
 
 
 
14
  CMD ["python", "app.py"]
 
1
+ # Use an official Python runtime as a parent image
2
  FROM python:3.9
3
 
4
+ # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
+ # Set environment variables to configure cache location
8
+ ENV TRANSFORMERS_CACHE=/tmp/cache
9
+ RUN mkdir -p /tmp/cache && chmod 777 /tmp/cache
10
+
11
+ # Install system dependencies
12
+ RUN apt-get update && apt-get install -y \
13
+ git \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Install Python dependencies
17
  COPY requirements.txt requirements.txt
18
+ RUN pip install --no-cache-dir --upgrade pip
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # Copy the application code
 
 
 
22
  COPY . .
23
 
24
+ # Expose the port for running the app (modify if needed)
25
+ EXPOSE 7860
26
+
27
+ # Run the application
28
  CMD ["python", "app.py"]