Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +11 -6
Dockerfile
CHANGED
|
@@ -1,16 +1,21 @@
|
|
| 1 |
FROM calciumion/new-api:latest
|
| 2 |
|
| 3 |
-
#
|
| 4 |
USER root
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
RUN pip3 install flask requests mysql-connector-python --break-system-packages
|
| 7 |
|
| 8 |
-
# Copy the shield script
|
| 9 |
COPY shield.py /app/shield.py
|
| 10 |
|
| 11 |
-
# Hugging Face port
|
| 12 |
ENV PORT=7860
|
| 13 |
EXPOSE 7860
|
| 14 |
|
| 15 |
-
# Start
|
| 16 |
-
|
|
|
|
|
|
| 1 |
FROM calciumion/new-api:latest
|
| 2 |
|
| 3 |
+
# 1. Switch to root to install dependencies
|
| 4 |
USER root
|
| 5 |
+
|
| 6 |
+
# 2. Update and install Python and pip
|
| 7 |
+
RUN apt-get update && apt-get install -y python3 python3-pip ca-certificates && rm -rf /var/lib/apt/lists/*
|
| 8 |
+
|
| 9 |
+
# 3. Install necessary Python libraries
|
| 10 |
RUN pip3 install flask requests mysql-connector-python --break-system-packages
|
| 11 |
|
| 12 |
+
# 4. Copy the shield script into the app directory
|
| 13 |
COPY shield.py /app/shield.py
|
| 14 |
|
| 15 |
+
# 5. Set Hugging Face port environment variables
|
| 16 |
ENV PORT=7860
|
| 17 |
EXPOSE 7860
|
| 18 |
|
| 19 |
+
# 6. Start NewAPI in the background on port 3000,
|
| 20 |
+
# then start Shield on port 7860 in the foreground.
|
| 21 |
+
CMD /new-api --port 3000 & python3 /app/shield.py
|