WebashalarForML commited on
Commit
a2e9365
·
verified ·
1 Parent(s): 217e8a1

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -7
Dockerfile CHANGED
@@ -11,30 +11,45 @@ WORKDIR /app
11
  # Copy the requirements file into the container at /app
12
  COPY requirements.txt /app/
13
 
14
- # Install build dependencies for numba/llvmlite (LLVM and Clang)
15
  # This uses the default available LLVM/Clang versions for Debian Bookworm
16
  RUN apt-get update && \
17
  apt-get install -y --no-install-recommends \
18
  llvm \
19
  clang \
20
- # Add any other build essentials if needed by other packages
21
- build-essential && \
 
 
 
 
 
22
  rm -rf /var/lib/apt/lists/*
23
 
 
 
 
 
24
  # Install numpy first, as numba/llvmlite depend on it for building
25
- RUN pip install --no-cache-dir numpy
 
26
 
27
- # Install the rest of the dependencies and the SpaCy model in a single layer to optimize image size
28
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
29
 
30
  # Create necessary directories with appropriate permissions
31
  RUN mkdir -p /app/cache /app/uploads /app/results /app/checkpoints /app/temp \
32
  && chmod -R 777 /app/cache /app/uploads /app/results /app/checkpoints /app/temp
33
 
34
- # Ensure all relevant directories have the correct permissions
35
  RUN chmod -R 777 /app
36
 
37
  # Copy the rest of the application code to /app
 
38
  COPY . /app/
39
 
40
  # Expose the port the app runs on
 
11
  # Copy the requirements file into the container at /app
12
  COPY requirements.txt /app/
13
 
14
+ # Install build dependencies for numba/llvmlite (LLVM and Clang), including specific dev libraries
15
  # This uses the default available LLVM/Clang versions for Debian Bookworm
16
  RUN apt-get update && \
17
  apt-get install -y --no-install-recommends \
18
  llvm \
19
  clang \
20
+ # Essential build tools
21
+ build-essential \
22
+ # Libraries for llvmlite and cffi
23
+ libedit-dev \
24
+ libffi-dev \
25
+ # Python dev headers, often needed for compiling Python extensions
26
+ python3-dev && \
27
  rm -rf /var/lib/apt/lists/*
28
 
29
+ # Set LLVM_CONFIG environment variable *before* installing numba/llvmlite
30
+ # Use the version that apt-get install llvm provides (likely llvm-config-14 for Bookworm)
31
+ ENV LLVM_CONFIG=/usr/bin/llvm-config-14
32
+
33
  # Install numpy first, as numba/llvmlite depend on it for building
34
+ # It's explicitly installed here to ensure it's available for numba's build process.
35
+ RUN pip install --no-cache-dir numpy==1.22.4
36
 
37
+ # Install the rest of the dependencies and the SpaCy model
38
+ # Using --break-system-packages might be needed if pip complains about global installs,
39
+ # though --no-cache-dir is good for image size.
40
+ # Adding spacy download here to keep build clean
41
+ RUN pip install --no-cache-dir -r requirements.txt && \
42
+ python -m spacy download en_core_web_sm
43
 
44
  # Create necessary directories with appropriate permissions
45
  RUN mkdir -p /app/cache /app/uploads /app/results /app/checkpoints /app/temp \
46
  && chmod -R 777 /app/cache /app/uploads /app/results /app/checkpoints /app/temp
47
 
48
+ # Ensure all relevant directories have the correct permissions (redundant for /app itself if contents are copied later)
49
  RUN chmod -R 777 /app
50
 
51
  # Copy the rest of the application code to /app
52
+ # This should be done AFTER all dependencies are installed
53
  COPY . /app/
54
 
55
  # Expose the port the app runs on