leonsimon23 commited on
Commit
f237c8c
·
verified ·
1 Parent(s): 03b3f95

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -8
Dockerfile CHANGED
@@ -1,22 +1,38 @@
1
- FROM python:3.9-slim-buster
 
2
 
 
 
 
 
 
3
  WORKDIR /app
4
 
 
 
 
 
 
 
5
  COPY requirements.txt .
6
- RUN pip install -r requirements.txt
7
 
 
 
 
 
 
8
  COPY . .
9
 
10
- # Change ownership of the /app directory to allow write access
11
- RUN chown -R 1000:1000 /app
12
 
13
- # Set environment variables
 
14
  ENV CHAINLIT_AUTH_SECRET="xOIPIMBGfI7N*VK6O~KOVIRC/cGRNSmk%bmO4Q@el647hR?^mdW6=8KlQBuWWTbk"
15
  ENV FASTGPT_BASE_URL="https://share.fastgpt.in"
16
  ENV FASTGPT_API_KEY="fastgpt-key"
17
  ENV FASTGPT_SHARE_ID=""
18
  ENV FASTGPT_API_DETAIL=False
19
 
20
- EXPOSE 8000
21
-
22
- CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "8000"]
 
1
+ # Use the official Python slim image as the base
2
+ FROM python:3.10-slim
3
 
4
+ # Set environment variables to optimize Python
5
+ ENV PYTHONDONTWRITEBYTECODE=1
6
+ ENV PYTHONUNBUFFERED=1
7
+
8
+ # Set the working directory in the container
9
  WORKDIR /app
10
 
11
+ # Install system dependencies
12
+ RUN apt-get update && apt-get install -y \
13
+ build-essential \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Copy the requirements file into the container
17
  COPY requirements.txt .
 
18
 
19
+ # Install Python dependencies
20
+ RUN pip install --upgrade pip && \
21
+ pip install --no-cache-dir -r requirements.txt
22
+
23
+ # Copy the rest of the application code into the container
24
  COPY . .
25
 
26
+ # Make port 8000 available to the world outside this container
27
+ EXPOSE 8000
28
 
29
+ # Define environment variables (you can also set these in Huggingface Spaces settings)
30
+ # It's recommended to use secrets management for sensitive information
31
  ENV CHAINLIT_AUTH_SECRET="xOIPIMBGfI7N*VK6O~KOVIRC/cGRNSmk%bmO4Q@el647hR?^mdW6=8KlQBuWWTbk"
32
  ENV FASTGPT_BASE_URL="https://share.fastgpt.in"
33
  ENV FASTGPT_API_KEY="fastgpt-key"
34
  ENV FASTGPT_SHARE_ID=""
35
  ENV FASTGPT_API_DETAIL=False
36
 
37
+ # Define the default command to run the Chainlit application
38
+ CMD ["chainlit", "run", "app.py", "-w", "--host", "0.0.0.0", "--port", "8000"]