ojaskittur commited on
Commit
832a62a
·
1 Parent(s): 3c9cf51

Fix Java version package error

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -7
Dockerfile CHANGED
@@ -1,30 +1,32 @@
 
 
1
  FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
 
5
- # 1. Install System Dependencies (Java for LanguageTool, Build tools for safety)
 
 
6
  RUN apt-get update && \
7
- apt-get install -y openjdk-17-jdk-headless build-essential git && \
8
  rm -rf /var/lib/apt/lists/*
9
 
10
  # 2. Copy files
11
  COPY . .
12
 
13
  # 3. Install Python libraries
14
- # We add --verbose to see errors if pip fails
15
  RUN pip install --no-cache-dir --upgrade pip && \
16
  pip install --no-cache-dir -r requirements.txt
17
 
18
- # 4. Create User (Robust Version)
19
- # Checks if user exists; if not, creates it. Handles existing ID 1000.
20
  RUN id -u user &>/dev/null || useradd -m -u 1000 user
21
 
22
  # 5. Fix Permissions
23
- # Ensure the new user owns the app directory and home directory
24
  RUN chown -R user:user /app && \
25
  chown -R user:user /home/user
26
 
27
- # 6. Switch to User
28
  USER user
29
  ENV HOME=/home/user \
30
  PATH=/home/user/.local/bin:$PATH
 
1
+ # Use specific bookworm tag to ensure stability, or stick to slim
2
+ # We will use the generic slim but fix the Java install
3
  FROM python:3.11-slim
4
 
5
  WORKDIR /app
6
 
7
+ # 1. Install System Dependencies
8
+ # Changed 'openjdk-17-jdk-headless' to 'default-jdk-headless'
9
+ # This automatically picks the correct available Java version (likely 21)
10
  RUN apt-get update && \
11
+ apt-get install -y default-jdk-headless build-essential git && \
12
  rm -rf /var/lib/apt/lists/*
13
 
14
  # 2. Copy files
15
  COPY . .
16
 
17
  # 3. Install Python libraries
18
+ # --upgrade pip first to avoid wheel build issues
19
  RUN pip install --no-cache-dir --upgrade pip && \
20
  pip install --no-cache-dir -r requirements.txt
21
 
22
+ # 4. Create User (Robust Check)
 
23
  RUN id -u user &>/dev/null || useradd -m -u 1000 user
24
 
25
  # 5. Fix Permissions
 
26
  RUN chown -R user:user /app && \
27
  chown -R user:user /home/user
28
 
29
+ # 6. Switch User
30
  USER user
31
  ENV HOME=/home/user \
32
  PATH=/home/user/.local/bin:$PATH