Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +15 -7
Dockerfile
CHANGED
|
@@ -1,18 +1,25 @@
|
|
| 1 |
FROM clickhouse/clickhouse-server:latest
|
| 2 |
|
| 3 |
-
# Install system dependencies
|
| 4 |
-
RUN apt-get update && apt-get install -y git python3 python3-pip sudo
|
| 5 |
-
RUN pip3 install fastapi uvicorn pydantic requests --break-system-packages
|
| 6 |
|
| 7 |
-
# Create the exact directory structure
|
| 8 |
RUN mkdir -p /app/ch/user_files /app/sql_repo
|
| 9 |
|
| 10 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
RUN chmod -R 777 /app /var/lib/clickhouse /var/log/clickhouse-server /etc/clickhouse-server
|
| 12 |
|
| 13 |
WORKDIR /app
|
| 14 |
|
| 15 |
-
# Copy configuration and application files
|
| 16 |
COPY ch_override.xml /etc/clickhouse-server/config.d/ch_override.xml
|
| 17 |
COPY config.json /app/config.json
|
| 18 |
COPY app.py /app/app.py
|
|
@@ -20,4 +27,5 @@ COPY app.py /app/app.py
|
|
| 20 |
# Hugging Face exposes port 7860
|
| 21 |
EXPOSE 7860
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
| 1 |
FROM clickhouse/clickhouse-server:latest
|
| 2 |
|
| 3 |
+
# 1. Install system dependencies including python3-venv
|
| 4 |
+
RUN apt-get update && apt-get install -y git python3 python3-pip python3-venv sudo
|
|
|
|
| 5 |
|
| 6 |
+
# 2. Create the exact directory structure requested
|
| 7 |
RUN mkdir -p /app/ch/user_files /app/sql_repo
|
| 8 |
|
| 9 |
+
# 3. Create a Python Virtual Environment
|
| 10 |
+
# This safely isolates your Python packages from the system OS
|
| 11 |
+
RUN python3 -m venv /app/venv
|
| 12 |
+
|
| 13 |
+
# 4. Install packages INSIDE the virtual environment
|
| 14 |
+
# We use the venv's pip, so we don't need any special system-breaking flags
|
| 15 |
+
RUN /app/venv/bin/pip install --no-cache-dir fastapi uvicorn pydantic requests
|
| 16 |
+
|
| 17 |
+
# 5. Open permissions for Hugging Face Spaces compatibility (UID 1000)
|
| 18 |
RUN chmod -R 777 /app /var/lib/clickhouse /var/log/clickhouse-server /etc/clickhouse-server
|
| 19 |
|
| 20 |
WORKDIR /app
|
| 21 |
|
| 22 |
+
# 6. Copy configuration and application files
|
| 23 |
COPY ch_override.xml /etc/clickhouse-server/config.d/ch_override.xml
|
| 24 |
COPY config.json /app/config.json
|
| 25 |
COPY app.py /app/app.py
|
|
|
|
| 27 |
# Hugging Face exposes port 7860
|
| 28 |
EXPOSE 7860
|
| 29 |
|
| 30 |
+
# 7. Run the Python gateway using the virtual environment's Python binary!
|
| 31 |
+
CMD ["/app/venv/bin/python", "app.py"]
|