LightRT commited on
Commit
fcf6b24
·
1 Parent(s): 4fd597b
Files changed (4) hide show
  1. .dockerignore +2 -1
  2. .gitignore +2 -1
  3. Dockerfile +6 -30
  4. start.sh +0 -7
.dockerignore CHANGED
@@ -3,4 +3,5 @@
3
  .env
4
  .venv/
5
  __pycache__/
6
- *.pyc
 
 
3
  .env
4
  .venv/
5
  __pycache__/
6
+ *.pyc
7
+ app.py
.gitignore CHANGED
@@ -4,4 +4,5 @@ __pycache__/
4
  .venv/
5
  .env/
6
  venv/.env
7
- .env
 
 
4
  .venv/
5
  .env/
6
  venv/.env
7
+ .env
8
+ app.py
Dockerfile CHANGED
@@ -1,41 +1,17 @@
1
- # 1. Base Image
2
  FROM python:3.11-slim
3
-
4
- # 2. Environment Variables for Hugging Face compatibility
5
- ENV PYTHONUNBUFFERED=1 \
6
- PYTHONDONTWRITEBYTECODE=1 \
7
- HOME=/app \
8
- PATH=/app/.local/bin:$PATH
9
-
10
- WORKDIR /app
11
-
12
- # 3. Install System Dependencies
13
- # libpq-dev is for PostgreSQL, curl is for Streamlit health checks
14
  RUN apt-get update && apt-get install -y \
15
  build-essential \
16
  libpq-dev \
17
- curl \
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
- # 4. Install uv (The blazing fast package manager)
21
- RUN pip install uv
22
 
23
- # 5. Cache & Install Python Dependencies
24
- COPY pyproject.toml uv.lock ./
25
- RUN uv pip install --system -r pyproject.toml
26
 
27
- # 6. Copy your application code
28
  COPY . .
29
 
30
- # 7. Permissions: Make the script executable
31
- RUN chmod +x start.sh
32
-
33
- # 8. Permissions: Hugging Face runs as user 1000, not root!
34
- RUN chown -R 1000:1000 /app
35
- USER 1000
36
-
37
- # 9. Expose Ports (7860 for UI, 8000 for internal API)
38
- EXPOSE 7860 8000
39
 
40
- # 10. Start the application
41
- CMD ["./start.sh"]
 
 
1
  FROM python:3.11-slim
2
+ \
 
 
 
 
 
 
 
 
 
 
3
  RUN apt-get update && apt-get install -y \
4
  build-essential \
5
  libpq-dev \
 
6
  && rm -rf /var/lib/apt/lists/*
7
 
8
+ WORKDIR /app
 
9
 
10
+ COPY requirements.txt .
11
+ RUN pip install --no-cache-dir -r requirements.txt
 
12
 
 
13
  COPY . .
14
 
15
+ EXPOSE 7860
 
 
 
 
 
 
 
 
16
 
17
+ CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
start.sh DELETED
@@ -1,7 +0,0 @@
1
- echo "Starting FastAPI Backend..."
2
- uv run uvicorn src.main:app --host 0.0.0.0 --port 8000 &
3
-
4
- sleep 3
5
-
6
- echo "Starting Streamlit Frontend..."
7
- uv run streamlit run app.py --server.port=7860 --server.address=0.0.0.0