Severian commited on
Commit
001f209
·
verified ·
1 Parent(s): 1e6dfb0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -17
Dockerfile CHANGED
@@ -11,18 +11,21 @@ ENV NODE_VERSION=20.11.0 \
11
  POETRY_VIRTUALENVS_CREATE=false \
12
  POETRY_CACHE_DIR=/cache/poetry
13
 
14
- # Install Node.js
15
- RUN apt-get update && apt-get install -y curl && \
16
- curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
17
- apt-get install -y nodejs && \
18
- npm install -g npm@latest
 
 
 
19
 
20
  # Web builder stage
21
  FROM base AS web-builder
22
 
23
- WORKDIR /app/web
24
 
25
- # Pull and build web components
26
  RUN git clone --depth 1 https://github.com/langgenius/dify.git . && \
27
  cd web && \
28
  npm ci && \
@@ -32,9 +35,9 @@ RUN git clone --depth 1 https://github.com/langgenius/dify.git . && \
32
  # API builder stage
33
  FROM base AS api-builder
34
 
35
- WORKDIR /app/api
36
 
37
- # Pull and build API components
38
  RUN git clone --depth 1 https://github.com/langgenius/dify.git . && \
39
  cd api && \
40
  pip install --no-cache-dir poetry && \
@@ -47,12 +50,6 @@ FROM base
47
  # Create non-root user (required by Hugging Face)
48
  RUN useradd -m -u 1000 user
49
 
50
- # Install runtime dependencies
51
- RUN apt-get update && \
52
- apt-get install -y --no-install-recommends \
53
- git \
54
- && rm -rf /var/lib/apt/lists/*
55
-
56
  # Set up directory structure
57
  WORKDIR /app
58
  RUN mkdir -p api web && chown -R user:user /app
@@ -67,7 +64,7 @@ COPY --from=web-builder --chown=user /app/web/.next/static /app/web/.next/static
67
  # Install Python requirements
68
  RUN pip install --no-cache-dir gunicorn gevent
69
 
70
- # Set environment variables for Hugging Face Spaces
71
  ENV FLASK_APP=app.py \
72
  EDITION=SELF_HOSTED \
73
  DEPLOY_ENV=PRODUCTION \
@@ -80,7 +77,7 @@ ENV FLASK_APP=app.py \
80
  # Switch to non-root user
81
  USER user
82
 
83
- # Expose Hugging Face Spaces required ports
84
  EXPOSE 7860 3000
85
 
86
  # Create startup script
 
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 \
16
+ curl \
17
+ git \
18
+ && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
19
+ && apt-get install -y nodejs \
20
+ && npm install -g npm@latest \
21
+ && rm -rf /var/lib/apt/lists/*
22
 
23
  # Web builder stage
24
  FROM base AS web-builder
25
 
26
+ WORKDIR /app
27
 
28
+ # Clone repository and build web components
29
  RUN git clone --depth 1 https://github.com/langgenius/dify.git . && \
30
  cd web && \
31
  npm ci && \
 
35
  # API builder stage
36
  FROM base AS api-builder
37
 
38
+ WORKDIR /app
39
 
40
+ # Clone repository and build API components
41
  RUN git clone --depth 1 https://github.com/langgenius/dify.git . && \
42
  cd api && \
43
  pip install --no-cache-dir poetry && \
 
50
  # Create non-root user (required by Hugging Face)
51
  RUN useradd -m -u 1000 user
52
 
 
 
 
 
 
 
53
  # Set up directory structure
54
  WORKDIR /app
55
  RUN mkdir -p api web && chown -R user:user /app
 
64
  # Install Python requirements
65
  RUN pip install --no-cache-dir gunicorn gevent
66
 
67
+ # Set environment variables
68
  ENV FLASK_APP=app.py \
69
  EDITION=SELF_HOSTED \
70
  DEPLOY_ENV=PRODUCTION \
 
77
  # Switch to non-root user
78
  USER user
79
 
80
+ # Expose required ports
81
  EXPOSE 7860 3000
82
 
83
  # Create startup script