Fred808 commited on
Commit
6489a64
·
verified ·
1 Parent(s): edb8ef2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -6
Dockerfile CHANGED
@@ -1,18 +1,26 @@
1
- # Use an official Python image
2
  FROM python:3.10-slim
3
 
 
 
 
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Copy local code to the container
8
- COPY . .
9
 
10
- # Install pip dependencies
 
11
  RUN pip install --upgrade pip && \
12
  pip install -r requirements.txt
13
 
14
- # Expose any necessary ports (optional)
 
 
 
15
  EXPOSE 7860
16
 
17
- # Set the entrypoint to run main.py
18
  CMD ["python", "main.py"]
 
1
+ # Use official Python image
2
  FROM python:3.10-slim
3
 
4
+ # Set environment variables
5
+ ENV PYTHONDONTWRITEBYTECODE=1
6
+ ENV PYTHONUNBUFFERED=1
7
+
8
  # Set working directory
9
  WORKDIR /app
10
 
11
+ # Install system dependencies
12
+ RUN apt-get update && apt-get install -y gcc
13
 
14
+ # Copy requirements and install first (for better layer caching)
15
+ COPY requirements.txt .
16
  RUN pip install --upgrade pip && \
17
  pip install -r requirements.txt
18
 
19
+ # Copy the rest of the code
20
+ COPY . .
21
+
22
+ # Expose FastAPI default port
23
  EXPOSE 7860
24
 
25
+ # Command to run the app
26
  CMD ["python", "main.py"]