samu commited on
Commit
c2fdecf
·
1 Parent(s): 9183203

modify docker

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -27
Dockerfile CHANGED
@@ -1,34 +1,22 @@
1
- FROM python:3.10-slim
 
2
 
3
- # Set working directory
4
- WORKDIR /app
5
 
6
- # Install system dependencies
7
- RUN apt-get update && \
8
- apt-get install -y curl python3-pip
9
 
10
- # Copy requirements first for better caching
11
- COPY requirements.txt .
12
- RUN pip install --no-cache-dir -r requirements.txt
13
 
14
- # Copy application code
15
- COPY backend ./backend
16
- COPY frontend ./frontend
17
 
18
- # Create startup script in a standard location
19
- RUN echo '#!/bin/bash\n\
20
- # Start backend server\n\
21
- uvicorn backend.main:app --host 0.0.0.0 --port 8002 &\n\
22
- \n\
23
- # Start frontend server\n\
24
- cd frontend && python -m http.server 8080 &\n\
25
- \n\
26
- # Wait for either process to exit\n\
27
- wait' > /usr/local/bin/start.sh && \
28
- chmod +x /usr/local/bin/start.sh
29
 
30
- # Expose ports for both services
31
- EXPOSE 8002 8080
32
 
33
- # Start both servers
34
- CMD ["/usr/local/bin/start.sh"]
 
1
+ # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
 
4
+ FROM python:3.9
 
5
 
6
+ # Required for Hugging Face Spaces Dev Mode functionality
7
+ RUN useradd -m -u 1000 user
8
+ WORKDIR /app
9
 
10
+ COPY --chown=user ./requirements.txt requirements.txt
11
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
12
 
13
+ COPY --chown=user . /app
 
 
14
 
15
+ # Create and set permissions for logs directory in /tmp
16
+ RUN mkdir -p /tmp/schematic_ai_logs && \
17
+ chown user:user /tmp/schematic_ai_logs
 
 
 
 
 
 
 
 
18
 
19
+ USER user
 
20
 
21
+ # Use Hugging Face's default port 7860
22
+ CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]