Spaces:
Paused
Paused
Commit
•
cc9baa0
1
Parent(s):
b676f5b
revert back to working build
Browse files- Docker +0 -13
- Dockerfile +17 -0
- app.py +0 -20
- requirements.txt +1 -2
- start_server.sh +6 -4
Docker
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
FROM python:3.9
|
2 |
-
|
3 |
-
RUN useradd -m -u 1000 user
|
4 |
-
USER user
|
5 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
6 |
-
|
7 |
-
WORKDIR /app
|
8 |
-
|
9 |
-
COPY --chown=user ./requirements.txt requirements.txt
|
10 |
-
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
11 |
-
|
12 |
-
COPY --chown=user . /app
|
13 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dockerfile
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9-slim
|
2 |
+
|
3 |
+
ENV PYTHONUNBUFFERED=1 \
|
4 |
+
SHELL=/bin/bash
|
5 |
+
|
6 |
+
WORKDIR /app
|
7 |
+
|
8 |
+
COPY requirements.txt .
|
9 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
10 |
+
|
11 |
+
COPY start_server.sh .
|
12 |
+
|
13 |
+
RUN chmod +x start_server.sh
|
14 |
+
|
15 |
+
EXPOSE 7860
|
16 |
+
|
17 |
+
CMD ["./start_server.sh"]
|
app.py
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import subprocess
|
3 |
-
|
4 |
-
if __name__ == "__main__":
|
5 |
-
# Ensure the /data directory exists
|
6 |
-
os.makedirs("/data/mlruns", exist_ok=True)
|
7 |
-
os.makedirs("/data", exist_ok=True)
|
8 |
-
|
9 |
-
# Optional: Set permissions (be cautious with permissions in production)
|
10 |
-
os.chmod("/data", 0o777)
|
11 |
-
os.chmod("/data/mlruns", 0o777)
|
12 |
-
|
13 |
-
# Start the MLflow server
|
14 |
-
subprocess.run([
|
15 |
-
"mlflow", "server",
|
16 |
-
"--backend-store-uri", "sqlite:////data/mlflow.db",
|
17 |
-
"--default-artifact-root", "/data/mlruns",
|
18 |
-
"--host", "0.0.0.0",
|
19 |
-
"--port", "7860"
|
20 |
-
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
@@ -1,2 +1 @@
|
|
1 |
-
mlflow=~2.16.1
|
2 |
-
fastapi
|
|
|
1 |
+
mlflow=~2.16.1
|
|
start_server.sh
CHANGED
@@ -1,12 +1,14 @@
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
-
# Ensure the /data directory exists
|
4 |
mkdir -p /data/mlruns
|
|
|
|
|
5 |
chmod -R 777 /data
|
6 |
|
7 |
# Start the MLflow server
|
8 |
mlflow server \
|
9 |
-
--host 0.0.0.0 \
|
10 |
-
--port 7860 \
|
11 |
--backend-store-uri sqlite:////data/mlflow.db \
|
12 |
-
--default-artifact-root /data/mlruns
|
|
|
|
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
+
# Ensure the /data directory exists
|
4 |
mkdir -p /data/mlruns
|
5 |
+
|
6 |
+
# Optional: Set permissions
|
7 |
chmod -R 777 /data
|
8 |
|
9 |
# Start the MLflow server
|
10 |
mlflow server \
|
|
|
|
|
11 |
--backend-store-uri sqlite:////data/mlflow.db \
|
12 |
+
--default-artifact-root /data/mlruns \
|
13 |
+
--host 0.0.0.0 \
|
14 |
+
--port 7860
|