Severian commited on
Commit
f998768
·
verified ·
1 Parent(s): 645f280

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -48
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  # Base Python image with correct version
2
- FROM python:3.11-slim-bookworm AS base
3
 
4
  # Set shared environment variables
5
  ENV NODE_VERSION=20.11.0 \
@@ -7,9 +7,11 @@ ENV NODE_VERSION=20.11.0 \
7
  NEXT_TELEMETRY_DISABLED=1 \
8
  NODE_ENV=production \
9
  PYTHONDONTWRITEBYTECODE=1 \
 
10
  POETRY_NO_INTERACTION=1 \
11
- POETRY_VIRTUALENVS_CREATE=false \
12
- POETRY_CACHE_DIR=/cache/poetry
 
13
 
14
  # Install system dependencies
15
  RUN apt-get update && apt-get install -y \
@@ -23,7 +25,8 @@ RUN apt-get update && apt-get install -y \
23
  && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
24
  && apt-get install -y nodejs \
25
  && npm install -g npm@latest \
26
- && rm -rf /var/lib/apt/lists/*
 
27
 
28
  # Pull official images
29
  FROM langgenius/dify-web:latest AS web
@@ -44,51 +47,15 @@ RUN mkdir -p api web /data/storage && \
44
  COPY --from=web --chown=user /app/web /app/web/
45
  COPY --from=api --chown=user /app/api /app/api/
46
 
 
 
47
 
48
- RUN pip install --no-cache-dir \
49
- gunicorn~=22.0.0 \
50
- gevent~=24.11.1 \
51
- flask~=3.0.1 \
52
- flask-cors~=4.0.0 \
53
- flask-sqlalchemy~=3.1.1 \
54
- grpcio~=1.59.0 \
55
- grpcio-tools~=1.59.0 \
56
- pydantic-settings~=2.6.0 \
57
- pydantic~=2.9.2 \
58
- flask-migrate~=4.0.0 \
59
- flask-login~=0.6.3 \
60
- flask-limiter~=3.8.0 \
61
- flask-restful~=0.3.10 \
62
- fastapi~=0.109.0 \
63
- uvicorn~=0.23.0 \
64
- python-multipart~=0.0.17 \
65
- python-jose[cryptography]~=3.3.0 \
66
- passlib[bcrypt]~=1.7.4 \
67
- sqlalchemy~=2.0.24 \
68
- psycopg2-binary~=2.9.9 \
69
- alembic~=1.14.0 \
70
- "redis[hiredis]~=5.0.3" \
71
- celery~=5.3.1 \
72
- flower~=1.3.1 \
73
- pytest~=7.4.3 \
74
- pytest-cov~=4.1.0 \
75
- pytest-asyncio~=0.21.1 \
76
- httpx~=0.24.1 \
77
- PyYAML~=6.0.1 \
78
- python-dotenv~=1.11.4 \
79
- requests~=2.31.0 \
80
- aiohttp~=4.0.3 \
81
- boto3~=2.0.2 \
82
- minio~=7.1.1 \
83
- tiktoken~=0.4.0 \
84
- openai~=4.1.0 \
85
- tenacity~=2.2.1 \
86
- cryptography~=41.0.1 \
87
- gmpy2==2.2.1 \
88
- transformers~=4.33.2 \
89
- torch~=2.1.0 \
90
- sentencepiece~=0.1.99 \
91
- protobuf~=5.1.1
92
 
93
  # Create symlink for persistent storage
94
  RUN ln -s /data/storage /app/api/storage
 
1
  # Base Python image with correct version
2
+ FROM python:3.12-slim-bookworm AS base
3
 
4
  # Set shared environment variables
5
  ENV NODE_VERSION=20.11.0 \
 
7
  NEXT_TELEMETRY_DISABLED=1 \
8
  NODE_ENV=production \
9
  PYTHONDONTWRITEBYTECODE=1 \
10
+ POETRY_VERSION=1.8.4 \
11
  POETRY_NO_INTERACTION=1 \
12
+ POETRY_VIRTUALENVS_CREATE=true \
13
+ POETRY_VIRTUALENVS_IN_PROJECT=true \
14
+ POETRY_CACHE_DIR=/tmp/poetry_cache
15
 
16
  # Install system dependencies
17
  RUN apt-get update && apt-get install -y \
 
25
  && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
26
  && apt-get install -y nodejs \
27
  && npm install -g npm@latest \
28
+ && rm -rf /var/lib/apt/lists/* \
29
+ && pip install --no-cache-dir "poetry==${POETRY_VERSION}"
30
 
31
  # Pull official images
32
  FROM langgenius/dify-web:latest AS web
 
47
  COPY --from=web --chown=user /app/web /app/web/
48
  COPY --from=api --chown=user /app/api /app/api/
49
 
50
+ # Copy Poetry files
51
+ COPY --chown=user pyproject.toml poetry.lock poetry.toml ./api/
52
 
53
+ # Install dependencies
54
+ WORKDIR /app/api
55
+ RUN poetry install --no-root --no-dev
56
+
57
+ # Copy application code
58
+ COPY --chown=user . .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  # Create symlink for persistent storage
61
  RUN ln -s /data/storage /app/api/storage