3nd1f commited on
Commit
46b17f4
·
verified ·
1 Parent(s): aea2981

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +38 -0
Dockerfile ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official X-UI image as the base
2
+ FROM ghcr.io/mhsanaei/3x-ui:latest AS x-ui
3
+
4
+ # Use a lightweight web server image for the proxy
5
+ FROM nginx:alpine
6
+
7
+ # Copy the X-UI binary and files from the X-UI image
8
+ COPY --from=x-ui /usr/local/x-ui /usr/local/x-ui
9
+ COPY --from=x-ui /usr/local/bin/xray /usr/local/bin/xray
10
+
11
+ # Set up the working directory
12
+ WORKDIR /usr/local/x-ui
13
+
14
+ # Install dependencies and supervisord to run both services
15
+ RUN apk add --no-cache supervisor && \
16
+ mkdir -p /var/log/supervisor && \
17
+ mkdir -p /etc/x-ui
18
+
19
+ # Copy Nginx configuration to proxy requests
20
+ RUN echo 'server { \
21
+ listen 7860; \
22
+ location / { \
23
+ proxy_pass http://127.0.0.1:2053; \
24
+ proxy_http_version 1.1; \
25
+ proxy_set_header Upgrade $http_upgrade; \
26
+ proxy_set_header Connection "upgrade"; \
27
+ proxy_set_header Host $host; \
28
+ } \
29
+ }' > /etc/nginx/conf.d/default.conf
30
+
31
+ # Create supervisord config to run Nginx and X-UI together
32
+ RUN echo '[supervisord]\nnodaemon=true\n\n[program:nginx]\ncommand=nginx -g "daemon off;"\n\n[program:xui]\ncommand=/usr/local/x-ui/x-ui' > /etc/supervisor/conf.d/supervisord.conf
33
+
34
+ # Expose the Hugging Face Space port
35
+ EXPOSE 7860
36
+
37
+ # Start supervisord
38
+ CMD ["/usr/bin/supervisord"]