GopalKrushnaMahapatra commited on
Commit
d2439ee
·
verified ·
1 Parent(s): f4400c6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -18
Dockerfile CHANGED
@@ -1,33 +1,34 @@
1
- # Use Python 3.9 as base
2
  FROM python:3.10-slim
3
 
4
- # 1. Install Java (Updated to OpenJDK 21 as per error log)
5
  RUN apt-get update && \
6
- apt-get install -y openjdk-21-jre-headless && \
7
- apt-get clean;
 
 
 
 
8
 
9
- # Set Java Home environment variable (Updated to Java 21 path)
10
- ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
11
 
12
  # 2. Set working directory
13
  WORKDIR /app
14
 
15
- # 3. Copy requirements and install
16
- # We use the --no-cache-dir flag to keep the image smaller
 
 
 
 
 
17
  COPY requirements.txt .
18
  RUN pip install --no-cache-dir --upgrade pip && \
19
  pip install --no-cache-dir -r requirements.txt
20
 
21
- # 4. Create a cache directory for Transformers to avoid permission errors
22
- RUN mkdir -p /app/cache && chmod 777 /app/cache
23
- ENV TRANSFORMERS_CACHE=/app/cache
24
- ENV HF_HOME=/app/cache
25
-
26
- # 5. Copy the rest of the application
27
  COPY . .
28
 
29
- # 6. Expose the port
30
- EXPOSE 7860
31
-
32
- # 7. Command to run the app (Using app:app as you renamed the file)
33
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use Python 3.10
2
  FROM python:3.10-slim
3
 
4
+ # 1. Install Java 21 (Required for LanguageTool) and Build Tools
5
  RUN apt-get update && \
6
+ apt-get install -y \
7
+ openjdk-21-jre-headless \
8
+ build-essential \
9
+ python3-dev \
10
+ gcc \
11
+ && apt-get clean
12
 
13
+ # Set Java Home
14
+ ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64
15
 
16
  # 2. Set working directory
17
  WORKDIR /app
18
 
19
+ # 3. SET WRITABLE CACHE FOLDERS (Fixes Runtime Error)
20
+ ENV XDG_CACHE_HOME=/app/cache
21
+ ENV TRANSFORMERS_CACHE=/app/cache
22
+ ENV HF_HOME=/app/cache
23
+ RUN mkdir -p /app/cache && chmod 777 /app/cache
24
+
25
+ # 4. Install dependencies
26
  COPY requirements.txt .
27
  RUN pip install --no-cache-dir --upgrade pip && \
28
  pip install --no-cache-dir -r requirements.txt
29
 
30
+ # 5. Copy app
 
 
 
 
 
31
  COPY . .
32
 
33
+ # 6. Run app
 
 
 
34
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]