Severian commited on
Commit
9d4903c
1 Parent(s): cfa129e

fix: resolve package installation issues

Browse files

- Add proper package repository update
- Install build-essential and development packages
- Fix NLTK installation and data download
- Clean up package lists after installation

Files changed (1) hide show
  1. Dockerfile +27 -45
Dockerfile CHANGED
@@ -3,67 +3,49 @@
3
  # ============================================
4
  FROM python:3.10-slim-bookworm AS base
5
 
6
- # Configure build environment with optimized settings
7
- ENV NODE_OPTIONS="--max_old_space_size=4096" \
8
- NEXT_TELEMETRY_DISABLED=1 \
9
- NODE_ENV=production \
10
- PYTHONDONTWRITEBYTECODE=1 \
11
- TZ=UTC \
12
- STORAGE_DIR=/storage \
13
- PIP_NO_CACHE_DIR=1 \
14
- PIP_DISABLE_PIP_VERSION_CHECK=1
15
 
16
- # Install base system dependencies
17
  RUN apt-get update && \
18
- DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
19
- tzdata \
20
- git \
21
- curl \
22
- redis-server \
23
  build-essential \
24
  gcc \
25
  g++ \
26
- libc-dev \
27
  libffi-dev \
28
  libgmp-dev \
29
  libmpfr-dev \
30
  libmpc-dev \
31
  libssl-dev \
32
  make \
33
- pkg-config && \
34
- rm -f /etc/localtime && \
35
- ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
36
- echo $TZ > /etc/timezone && \
37
- apt-get clean && \
38
- rm -rf /var/lib/apt/lists/*
39
-
40
- # Split package installation into smaller chunks
41
- RUN pip install --no-cache-dir \
42
- gunicorn gevent grpcio pydantic-settings protobuf grpcio-tools && \
43
- pip install --no-cache-dir \
44
- flask flask-cors Flask-SQLAlchemy==3.1.1 Flask-Migrate==4.0.7 && \
45
- pip install --no-cache-dir \
46
- flask-login flask-restful flask-limiter flask-caching flask-jwt-extended flask-socketio && \
47
- pip install --no-cache-dir \
48
- PyYAML celery redis psycopg2-binary sqlalchemy alembic
49
 
50
- # Install ML-related packages separately
51
  RUN pip install --no-cache-dir \
52
- numpy pandas scikit-learn scipy && \
53
- pip install --no-cache-dir \
54
- torch --index-url https://download.pytorch.org/whl/cpu && \
55
- pip install --no-cache-dir \
56
- tensorflow-cpu
57
-
58
- # Install AI service packages
59
- RUN pip install --no-cache-dir \
60
- openai==1.14.0 anthropic==0.23.1 cohere==4.43 && \
61
- pip install --no-cache-dir \
62
- langchain langchain-community langchain-core langchain-openai
 
 
 
 
 
63
 
64
  # Install NLTK and download required data
65
  RUN pip install --no-cache-dir nltk && \
66
- python -m nltk.downloader punkt averaged_perceptron_tagger
67
 
68
  # ============================================
69
  # Web builder stage - optimized
 
3
  # ============================================
4
  FROM python:3.10-slim-bookworm AS base
5
 
6
+ # Force package update and installation at build time
7
+ ARG CACHEBUST=1
8
+ ARG DEBIAN_FRONTEND=noninteractive
 
 
 
 
 
 
9
 
10
+ # Update package lists and install essential build dependencies
11
  RUN apt-get update && \
12
+ apt-get install -y --no-install-recommends \
 
 
 
 
13
  build-essential \
14
  gcc \
15
  g++ \
16
+ libc6-dev \
17
  libffi-dev \
18
  libgmp-dev \
19
  libmpfr-dev \
20
  libmpc-dev \
21
  libssl-dev \
22
  make \
23
+ pkg-config \
24
+ && apt-get clean \
25
+ && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
+ # Install Python dependencies
28
  RUN pip install --no-cache-dir \
29
+ gunicorn \
30
+ gevent \
31
+ grpcio \
32
+ pydantic-settings \
33
+ protobuf \
34
+ grpcio-tools \
35
+ flask \
36
+ flask-cors \
37
+ Flask-SQLAlchemy==3.1.1 \
38
+ Flask-Migrate==4.0.7 \
39
+ flask-login \
40
+ flask-restful \
41
+ flask-limiter \
42
+ flask-caching \
43
+ flask-jwt-extended \
44
+ flask-socketio
45
 
46
  # Install NLTK and download required data
47
  RUN pip install --no-cache-dir nltk && \
48
+ python -c "import nltk; nltk.download('punkt'); nltk.download('averaged_perceptron_tagger')"
49
 
50
  # ============================================
51
  # Web builder stage - optimized