Factor Studios commited on
Commit
3aeaefa
·
verified ·
1 Parent(s): 74eb1b8

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +40 -0
Dockerfile ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.9-slim
3
+
4
+ # Set environment variables
5
+ ENV PYTHONUNBUFFERED=1
6
+
7
+ # Set working directory in container
8
+ WORKDIR /app
9
+
10
+ # Install system dependencies
11
+ RUN apt-get update && apt-get install -y \
12
+ gcc \
13
+ python3-dev \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Copy only the requirements file first
17
+ COPY /requirements.txt .
18
+
19
+ # Install Python dependencies
20
+ RUN pip install --no-cache-dir -r requirements.txt
21
+
22
+ # Copy the server code
23
+ COPY / .
24
+
25
+ # Create storage directories
26
+
27
+ # Create non-root user and set permissions
28
+ RUN useradd -m -u 1000 user
29
+
30
+ RUN chmod -R 777 /app
31
+
32
+ # Expose ports
33
+ EXPOSE 7860
34
+ EXPOSE 8765
35
+
36
+ # Set environment variable for storage path
37
+ ENV STORAGE_PATH=/app/storage
38
+
39
+ # Run the server using Uvicorn
40
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]