Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +52 -30
Dockerfile
CHANGED
|
@@ -1,38 +1,60 @@
|
|
| 1 |
-
# Use official Python slim image
|
| 2 |
-
FROM python:3.12-slim
|
| 3 |
-
|
| 4 |
-
# Set environment variables for HF Space
|
| 5 |
-
ENV PYTHONUNBUFFERED=1 \
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
# Install system dependencies
|
| 11 |
-
RUN apt-get update && apt-get install -y \
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
RUN
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# Set working directory
|
| 23 |
-
WORKDIR /
|
| 24 |
|
| 25 |
-
# Clone your GitHub
|
| 26 |
-
RUN git clone https://github.com/abubasith456/Ai-Knowledgebase.git
|
| 27 |
-
&& mv Ai-Knowledgebase/* /backend/ \
|
| 28 |
-
&& rm -rf Ai-Knowledgebase
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
|
| 32 |
-
RUN pip install -r requirements.txt
|
| 33 |
|
| 34 |
-
#
|
| 35 |
-
|
| 36 |
|
| 37 |
-
# Command to run your app
|
| 38 |
CMD ["python", "main.py"]
|
|
|
|
| 1 |
+
# # Use official Python slim image
|
| 2 |
+
# FROM python:3.12-slim
|
| 3 |
+
|
| 4 |
+
# # Set environment variables for HF Space
|
| 5 |
+
# ENV PYTHONUNBUFFERED=1 \
|
| 6 |
+
# PYTHONDONTWRITEBYTECODE=1 \
|
| 7 |
+
# LANG=C.UTF-8 \
|
| 8 |
+
# LC_ALL=C.UTF-8
|
| 9 |
+
|
| 10 |
+
# # Install system dependencies
|
| 11 |
+
# RUN apt-get update && apt-get install -y \
|
| 12 |
+
# git \
|
| 13 |
+
# build-essential \
|
| 14 |
+
# wget \
|
| 15 |
+
# curl \
|
| 16 |
+
# && rm -rf /var/lib/apt/lists/*
|
| 17 |
+
|
| 18 |
+
# # Create backend directory and temp storage with proper permissions
|
| 19 |
+
# RUN mkdir -p /backend /temp \
|
| 20 |
+
# && chmod -R 777 /backend /temp
|
| 21 |
+
|
| 22 |
+
# # Set working directory
|
| 23 |
+
# WORKDIR /backend
|
| 24 |
+
|
| 25 |
+
# # Clone your GitHub repo first, then move to /backend
|
| 26 |
+
# RUN git clone https://github.com/abubasith456/Ai-Knowledgebase.git \
|
| 27 |
+
# && mv Ai-Knowledgebase/* /backend/ \
|
| 28 |
+
# && rm -rf Ai-Knowledgebase
|
| 29 |
|
| 30 |
+
# # Upgrade pip and install Python dependencies
|
| 31 |
+
# RUN pip install --upgrade pip
|
| 32 |
+
# RUN pip install -r requirements.txt
|
| 33 |
+
|
| 34 |
+
# # Expose port (adjust if your app uses a different port)
|
| 35 |
+
# EXPOSE 8000
|
| 36 |
+
|
| 37 |
+
# # Command to run your app
|
| 38 |
+
# CMD ["python", "main.py"]
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
# Use a lightweight Python base image
|
| 42 |
+
FROM python:3.13-slim AS builder
|
| 43 |
+
|
| 44 |
+
# Install git so we can clone the repo
|
| 45 |
+
RUN apt-get update && apt-get install -y git --no-install-recommends \
|
| 46 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 47 |
|
| 48 |
# Set working directory
|
| 49 |
+
WORKDIR /app
|
| 50 |
|
| 51 |
+
# Clone your GitHub project
|
| 52 |
+
RUN git clone https://github.com/abubasith456/Ai-Knowledgebase.git .
|
|
|
|
|
|
|
| 53 |
|
| 54 |
+
# Move into the 'backend' directory
|
| 55 |
+
WORKDIR /app/backend
|
|
|
|
| 56 |
|
| 57 |
+
# Install Python dependencies
|
| 58 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 59 |
|
|
|
|
| 60 |
CMD ["python", "main.py"]
|