ShutterStack commited on
Commit
ae34495
·
verified ·
1 Parent(s): b4cdbd5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -7
Dockerfile CHANGED
@@ -1,27 +1,31 @@
1
  # Use a slim Python base image for efficiency
2
- FROM python:3.10
3
 
4
  # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
  # Copy the requirements.txt file first to leverage Docker's build cache.
8
- # If requirements.txt doesn't change, this step won't re-run.
9
  COPY requirements.txt .
10
 
11
- # Install Python dependencies
12
- # --no-cache-dir: Reduces image size by not storing build cache
13
- # -r requirements.txt: Installs all packages listed in requirements.txt
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
  # Install Nginx
17
  RUN apt-get update && apt-get install -y nginx && \
18
  rm -rf /var/lib/apt/lists/*
19
 
 
 
 
 
 
 
20
  # Copy the entire project directory into the container's /app directory.
21
  # This includes main.py, streamlit_app.py, routers/, utils/, data/, etc.
22
  COPY . .
23
 
24
- # Replace the default Nginx configuration with your custom one
 
25
  COPY nginx.conf /etc/nginx/nginx.conf
26
 
27
  # Grant execution permissions to the start.sh script
@@ -31,5 +35,4 @@ RUN chmod +x start.sh
31
  EXPOSE 7860
32
 
33
  # Define the command to run when the container starts.
34
- # This executes your start.sh script which then launches Flask, Streamlit, and Nginx.
35
  CMD ["./start.sh"]
 
1
  # Use a slim Python base image for efficiency
2
+ FROM python:3.10-slim-buster
3
 
4
  # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
  # Copy the requirements.txt file first to leverage Docker's build cache.
 
8
  COPY requirements.txt .
9
 
10
+ # Install Python dependencies (ensure gunicorn is listed in requirements.txt)
 
 
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
  # Install Nginx
14
  RUN apt-get update && apt-get install -y nginx && \
15
  rm -rf /var/lib/apt/lists/*
16
 
17
+ # Create a dedicated directory for Nginx's temporary files and set permissions.
18
+ # Nginx typically runs as the 'www-data' user, which needs write access here.
19
+ RUN mkdir -p /tmp/nginx_cache/client_body && \
20
+ chown -R www-data:www-data /tmp/nginx_cache && \
21
+ chmod -R 755 /tmp/nginx_cache
22
+
23
  # Copy the entire project directory into the container's /app directory.
24
  # This includes main.py, streamlit_app.py, routers/, utils/, data/, etc.
25
  COPY . .
26
 
27
+ # Replace the default Nginx configuration with your custom one.
28
+ # IMPORTANT: Your nginx.conf MUST be updated as shown in Step 2 to use the new temp path.
29
  COPY nginx.conf /etc/nginx/nginx.conf
30
 
31
  # Grant execution permissions to the start.sh script
 
35
  EXPOSE 7860
36
 
37
  # Define the command to run when the container starts.
 
38
  CMD ["./start.sh"]