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
- Dockerfile +27 -45
Dockerfile
CHANGED
@@ -3,67 +3,49 @@
|
|
3 |
# ============================================
|
4 |
FROM python:3.10-slim-bookworm AS base
|
5 |
|
6 |
-
#
|
7 |
-
|
8 |
-
|
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 |
-
#
|
17 |
RUN apt-get update && \
|
18 |
-
|
19 |
-
tzdata \
|
20 |
-
git \
|
21 |
-
curl \
|
22 |
-
redis-server \
|
23 |
build-essential \
|
24 |
gcc \
|
25 |
g++ \
|
26 |
-
|
27 |
libffi-dev \
|
28 |
libgmp-dev \
|
29 |
libmpfr-dev \
|
30 |
libmpc-dev \
|
31 |
libssl-dev \
|
32 |
make \
|
33 |
-
pkg-config
|
34 |
-
|
35 |
-
|
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
|
51 |
RUN pip install --no-cache-dir \
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
# Install NLTK and download required data
|
65 |
RUN pip install --no-cache-dir nltk && \
|
66 |
-
python -
|
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
|