GodRad commited on
Commit
333f30c
·
verified ·
1 Parent(s): 413974f

Upload 31 files

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -10
Dockerfile CHANGED
@@ -1,29 +1,34 @@
1
  FROM python:3.11-slim
2
 
 
 
 
 
 
 
 
3
  WORKDIR /app
4
 
5
  # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
- libpq-dev \
9
  curl \
 
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
  # Copy requirements and install
13
  COPY requirements.txt .
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
- # Copy application
17
  COPY . .
18
 
19
- # Set permissions for HF Spaces (user 1000)
20
- RUN useradd -m -u 1000 user
21
- RUN chown -R user:user /app
22
  USER user
23
 
24
- # Health check
25
- HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
26
- CMD curl -f http://0.0.0.0:${PORT:-7860}/health || exit 1
27
 
28
- # Start command
29
- CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-7860}"]
 
1
  FROM python:3.11-slim
2
 
3
+ # Set environment variables
4
+ ENV PYTHONUNBUFFERED=1 \
5
+ PYTHONDONTWRITEBYTECODE=1 \
6
+ PORT=7860
7
+
8
+ # Create user and set permissions (HF expectation)
9
+ RUN useradd -m -u 1000 user
10
  WORKDIR /app
11
 
12
  # Install system dependencies
13
  RUN apt-get update && apt-get install -y \
14
  build-essential \
 
15
  curl \
16
+ software-properties-common \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
  # Copy requirements and install
20
  COPY requirements.txt .
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
23
+ # Copy app code
24
  COPY . .
25
 
26
+ # Set permissions for user 1000
27
+ RUN chown -R 1000:1000 /app
 
28
  USER user
29
 
30
+ # Expose port
31
+ EXPOSE 7860
 
32
 
33
+ # Run entrypoint
34
+ ENTRYPOINT ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]