ICTuniverse commited on
Commit
2b7237e
·
verified ·
1 Parent(s): 8bae260

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -9
Dockerfile CHANGED
@@ -1,19 +1,31 @@
1
  # Use Python 3.10 slim as base image
2
  FROM python:3.10-slim
3
 
4
- # Install OpenJDK 11 (includes javac)
5
  RUN apt-get update && \
6
- apt-get install -y openjdk-17-jdk && \
 
 
 
 
 
 
7
  apt-get clean && \
8
  rm -rf /var/lib/apt/lists/*
9
 
10
- # Set JAVA_HOME and update PATH
11
- ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
12
- ENV PATH=$JAVA_HOME/bin:$PATH
 
 
 
13
  ENV JVM_PATH="$JAVA_HOME/lib/server/libjvm.so"
 
14
 
15
  # Verify Java installation
16
- RUN java -version && javac -version
 
 
17
 
18
  # Set working directory
19
  WORKDIR /home/user/app
@@ -21,11 +33,12 @@ WORKDIR /home/user/app
21
  # Copy application files
22
  COPY . .
23
 
24
- # Install Python dependencies
25
- RUN pip install --no-cache-dir -r requirements.txt
 
26
 
27
  # Expose port for HF Spaces
28
  EXPOSE 7860
29
 
30
  # Run the Flask app
31
- CMD ["python", "app.py"]
 
1
  # Use Python 3.10 slim as base image
2
  FROM python:3.10-slim
3
 
4
+ # Install OpenJDK 17 and required dependencies
5
  RUN apt-get update && \
6
+ apt-get install -y --no-install-recommends \
7
+ openjdk-17-jdk \
8
+ openjdk-17-jdk-headless \
9
+ ca-certificates \
10
+ wget \
11
+ curl \
12
+ libstdc++6 && \
13
  apt-get clean && \
14
  rm -rf /var/lib/apt/lists/*
15
 
16
+ # Find the actual Java installation path
17
+ RUN update-alternatives --config java || true && \
18
+ update-alternatives --config javac || true
19
+
20
+ # Manually set JAVA_HOME and JVM_PATH based on actual file location
21
+ ENV JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
22
  ENV JVM_PATH="$JAVA_HOME/lib/server/libjvm.so"
23
+ ENV PATH="${JAVA_HOME}/bin:${PATH}"
24
 
25
  # Verify Java installation
26
+ RUN echo "JAVA_HOME is set to $JAVA_HOME" && \
27
+ echo "JVM_PATH is set to $JVM_PATH" && \
28
+ java -version && javac -version && ls -l $JVM_PATH || echo "libjvm.so not found!"
29
 
30
  # Set working directory
31
  WORKDIR /home/user/app
 
33
  # Copy application files
34
  COPY . .
35
 
36
+ # Upgrade pip and install Python dependencies
37
+ RUN pip install --upgrade pip && \
38
+ pip install --no-cache-dir -r requirements.txt
39
 
40
  # Expose port for HF Spaces
41
  EXPOSE 7860
42
 
43
  # Run the Flask app
44
+ CMD ["python", "app.py"]