Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +25 -8
Dockerfile
CHANGED
|
@@ -1,14 +1,31 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
# Install dependencies
|
| 6 |
-
RUN
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
# Copy
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
|
|
|
|
|
|
|
| 12 |
EXPOSE 7860
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|