hzjanuary commited on
Commit
6448cfa
Β·
verified Β·
1 Parent(s): 5a61a06

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -14
Dockerfile CHANGED
@@ -1,52 +1,43 @@
1
  # ──────────────────────────────────────────────────────────────────────────────
2
- # easyResearch Assistant β€” Dockerfile (Optimized for Hugging Face)
3
  # ──────────────────────────────────────────────────────────────────────────────
4
 
5
  FROM python:3.10-slim
6
 
7
- # Set environment variables
8
  ENV PYTHONUNBUFFERED=1 \
9
  PYTHONDONTWRITEBYTECODE=1 \
10
  DEBIAN_FRONTEND=noninteractive \
11
  HOME=/home/user \
12
- PORT=7860
 
13
 
14
- # 1. Create user with UID 1000 (Mandatory for HF)
15
  RUN useradd -m -u 1000 user
16
  WORKDIR $HOME/app
17
 
18
- # 2. Install system dependencies
19
  RUN apt-get update && apt-get install -y --no-install-recommends \
20
  build-essential \
21
  curl \
22
  && apt-get clean \
23
  && rm -rf /var/lib/apt/lists/*
24
 
25
- # 3. Create necessary log and storage directories BEFORE switching user
26
  RUN mkdir -p logs && \
27
  touch logs/system.log && \
28
  chown -R user:user $HOME/app && \
29
  chmod -R 777 $HOME/app
30
 
31
- # 4. Copy and install requirements
32
  COPY --chown=user:user requirements.txt .
33
  RUN pip install --no-cache-dir --upgrade pip && \
34
  pip install --no-cache-dir -r requirements.txt
35
 
36
- # 5. Copy the rest of the application
37
  COPY --chown=user:user . .
38
 
39
- # 6. Switch to non-root user
40
  USER user
41
  ENV PATH=$HOME/.local/bin:$PATH
42
 
43
- # HF Spaces only exposes 7860
44
  EXPOSE 7860
45
 
46
- # 7. Launch script to run both Backend and Chat UI
47
- # - Backend runs on internal port 8000
48
- # - Chat UI runs on public port 7860
49
- CMD (python api_gateway.py --host 0.0.0.0 --port 8000 &) && \
50
  streamlit run streamlit_app.py \
51
  --server.port=7860 \
52
  --server.address=0.0.0.0 \
 
1
  # ──────────────────────────────────────────────────────────────────────────────
2
+ # easyResearch Assistant β€” Dockerfile (Optimized for HF Spaces)
3
  # ──────────────────────────────────────────────────────────────────────────────
4
 
5
  FROM python:3.10-slim
6
 
 
7
  ENV PYTHONUNBUFFERED=1 \
8
  PYTHONDONTWRITEBYTECODE=1 \
9
  DEBIAN_FRONTEND=noninteractive \
10
  HOME=/home/user \
11
+ LOG_FILE=/home/user/app/logs/system.log \
12
+ BACKEND_URL=http://localhost:8000
13
 
 
14
  RUN useradd -m -u 1000 user
15
  WORKDIR $HOME/app
16
 
 
17
  RUN apt-get update && apt-get install -y --no-install-recommends \
18
  build-essential \
19
  curl \
20
  && apt-get clean \
21
  && rm -rf /var/lib/apt/lists/*
22
 
 
23
  RUN mkdir -p logs && \
24
  touch logs/system.log && \
25
  chown -R user:user $HOME/app && \
26
  chmod -R 777 $HOME/app
27
 
 
28
  COPY --chown=user:user requirements.txt .
29
  RUN pip install --no-cache-dir --upgrade pip && \
30
  pip install --no-cache-dir -r requirements.txt
31
 
 
32
  COPY --chown=user:user . .
33
 
 
34
  USER user
35
  ENV PATH=$HOME/.local/bin:$PATH
36
 
 
37
  EXPOSE 7860
38
 
39
+
40
+ CMD (PORT=8000 python api_gateway.py &) && \
 
 
41
  streamlit run streamlit_app.py \
42
  --server.port=7860 \
43
  --server.address=0.0.0.0 \