Sadiksmart0 commited on
Commit
a887e31
·
verified ·
1 Parent(s): fbf85a4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -9
Dockerfile CHANGED
@@ -1,28 +1,31 @@
1
  FROM python:3.9-slim
2
 
3
- # Install dependencies
4
  RUN apt-get update && apt-get install -y curl && \
5
  curl -fsSL https://ollama.ai/install.sh | sh && \
6
  apt-get clean && rm -rf /var/lib/apt/lists/*
7
 
8
- # Create a user
9
  RUN useradd user
10
  USER user
11
  ENV HOME=/home/user
12
  WORKDIR $HOME/app
13
 
14
- # Copy files
15
  COPY --chown=user requirements.txt .
16
- RUN pip install -r requirements.txt
 
 
17
  COPY --chown=user . .
18
- # Copy files
19
  # Make the script executable
20
  RUN chmod +x start.sh
21
 
22
- RUN pip install uvicorn
 
23
 
24
- # Expose the port
25
  EXPOSE 7860
26
 
27
- # Start the application
28
- CMD ["./start.sh"]
 
1
  FROM python:3.9-slim
2
 
3
+ # Install system dependencies
4
  RUN apt-get update && apt-get install -y curl && \
5
  curl -fsSL https://ollama.ai/install.sh | sh && \
6
  apt-get clean && rm -rf /var/lib/apt/lists/*
7
 
8
+ # Create a non-root user
9
  RUN useradd user
10
  USER user
11
  ENV HOME=/home/user
12
  WORKDIR $HOME/app
13
 
14
+ # Copy and install requirements as the non-root user
15
  COPY --chown=user requirements.txt .
16
+ RUN pip install --user -r requirements.txt
17
+
18
+ # Copy the rest of the app
19
  COPY --chown=user . .
20
+
21
  # Make the script executable
22
  RUN chmod +x start.sh
23
 
24
+ # Add local bin to PATH (for --user installs)
25
+ ENV PATH="$HOME/.local/bin:$PATH"
26
 
27
+ # Expose port
28
  EXPOSE 7860
29
 
30
+ # Run the app
31
+ CMD ["./start.sh"]