Pommsn commited on
Commit
da5c398
·
verified ·
1 Parent(s): 54d9852

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -42
Dockerfile CHANGED
@@ -1,57 +1,27 @@
1
- # Dify All-in-One for Hugging Face Spaces
2
- # Uses pre-built images to avoid OOM during build
3
 
4
- FROM langgenius/dify-api:0.15.3 AS api
5
  FROM langgenius/dify-web:0.15.3 AS web
6
-
7
- # Final image based on API
8
  FROM langgenius/dify-api:0.15.3
9
 
10
  USER root
11
 
12
- # Install Redis, Nginx only (Node.js comes with web files)
13
- RUN apt-get update && apt-get install -y \
14
- redis-server \
15
- nginx \
16
- nodejs \
17
- npm \
18
- curl \
19
- && apt-get clean \
20
- && rm -rf /var/lib/apt/lists/*
21
-
22
- # Copy pre-built web from official image
23
  COPY --from=web /app/web /app/web
24
 
25
- # Copy configuration files
26
- COPY nginx.conf /etc/nginx/nginx.conf
27
  COPY start.sh /app/start.sh
 
 
 
28
 
29
- # Make start script executable
30
- RUN chmod +x /app/start.sh
31
-
32
- # Create directories and set permissions
33
- RUN mkdir -p /app/api/storage /var/log/nginx /var/lib/nginx /run /var/cache/nginx && \
34
- chown -R 1000:1000 /app /var/log/nginx /var/lib/nginx /run /var/cache/nginx /etc/nginx
35
-
36
- # Environment variables
37
- ENV PORT=7860
38
- ENV MODE=api
39
- ENV LOG_LEVEL=INFO
40
- ENV FLASK_DEBUG=false
41
- ENV DEBUG=false
42
- ENV STORAGE_TYPE=local
43
- ENV STORAGE_LOCAL_PATH=/app/api/storage
44
- ENV GUNICORN_TIMEOUT=360
45
 
46
- # Expose HF Spaces port
47
  EXPOSE 7860
48
-
49
- # Health check
50
- HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
51
- CMD curl -f http://localhost:7860/ || exit 1
52
-
53
- # Switch to non-root user
54
  USER 1000
55
-
56
  WORKDIR /app
57
  CMD ["/bin/bash", "/app/start.sh"]
 
1
+ # Dify for HF Spaces - ZERO APT INSTALL (Fastest Build)
2
+ # No apt-get, no waiting - just copy and run!
3
 
 
4
  FROM langgenius/dify-web:0.15.3 AS web
 
 
5
  FROM langgenius/dify-api:0.15.3
6
 
7
  USER root
8
 
9
+ # Copy pre-built web (NO apt-get install needed!)
 
 
 
 
 
 
 
 
 
 
10
  COPY --from=web /app/web /app/web
11
 
12
+ # Copy startup script
 
13
  COPY start.sh /app/start.sh
14
+ RUN chmod +x /app/start.sh && \
15
+ mkdir -p /app/api/storage && \
16
+ chown -R 1000:1000 /app
17
 
18
+ ENV PORT=7860 \
19
+ MODE=api \
20
+ DEBUG=false \
21
+ STORAGE_TYPE=local \
22
+ STORAGE_LOCAL_PATH=/app/api/storage
 
 
 
 
 
 
 
 
 
 
 
23
 
 
24
  EXPOSE 7860
 
 
 
 
 
 
25
  USER 1000
 
26
  WORKDIR /app
27
  CMD ["/bin/bash", "/app/start.sh"]