Philips656 commited on
Commit
e769df8
·
verified ·
1 Parent(s): d4cd2e4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -8
Dockerfile CHANGED
@@ -1,14 +1,31 @@
1
- FROM python:3.10-slim
 
2
 
3
- WORKDIR /app
 
 
 
 
 
 
 
4
 
5
- # Install dependencies
6
- RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
7
- RUN pip install flask requests mysql-connector-python
 
 
8
 
9
- # Copy ALL files (shield.py AND index.html)
10
- COPY . .
 
 
11
 
 
 
12
  EXPOSE 7860
13
 
14
- CMD ["python3", "shield.py"]
 
 
 
 
1
+ # Use the official NewAPI image as the foundation
2
+ FROM calciumion/new-api:latest
3
 
4
+ USER root
5
+
6
+ # 1. Install Python and Flask for the Shield/UI
7
+ RUN apt-get update && apt-get install -y \
8
+ python3 \
9
+ python3-pip \
10
+ ca-certificates \
11
+ && rm -rf /var/lib/apt/lists/*
12
 
13
+ # 2. Install Python dependencies
14
+ RUN pip3 install flask requests mysql-connector-python --break-system-packages
15
+
16
+ # 3. Set up the working directory
17
+ WORKDIR /app
18
 
19
+ # 4. Copy your custom UI and the Shield script
20
+ # Make sure these files are in the same folder as your Dockerfile!
21
+ COPY shield.py /app/shield.py
22
+ COPY index.html /app/index.html
23
 
24
+ # 5. Hugging Face uses port 7860
25
+ ENV PORT=7860
26
  EXPOSE 7860
27
 
28
+ # 6. The "Magic" Launch Command
29
+ # We start the real NewAPI on port 3000 in the background (&)
30
+ # Then we start the Python Shield on 7860 in the foreground
31
+ CMD /new-api --port 3000 & python3 /app/shield.py