ICTuniverse commited on
Commit
cb14fbd
·
verified ·
1 Parent(s): 4f56acc

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -22
Dockerfile CHANGED
@@ -1,31 +1,18 @@
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,9 +20,8 @@ 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
 
1
  # Use Python 3.10 slim as base image
2
  FROM python:3.10-slim
3
 
4
+ # Install OpenJDK 17 (includes javac and libjvm.so)
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
 
14
  # Verify Java installation
15
+ RUN java -version && javac -version
 
 
16
 
17
  # Set working directory
18
  WORKDIR /home/user/app
 
20
  # Copy application files
21
  COPY . .
22
 
23
+ # Install Python dependencies
24
+ RUN pip install --no-cache-dir -r requirements.txt
 
25
 
26
  # Expose port for HF Spaces
27
  EXPOSE 7860