abdullah-khaled commited on
Commit
35d1957
·
1 Parent(s): 52be2b2

fix the Dockerfile py image and README

Browse files
Files changed (2) hide show
  1. Dockerfile +22 -14
  2. README.md +12 -1
Dockerfile CHANGED
@@ -1,31 +1,39 @@
 
1
  FROM python:3.10.9-slim
2
 
 
 
 
 
 
 
 
 
 
3
  WORKDIR /app
4
 
5
- # Copy project files into the container
6
- COPY . .
7
 
8
- # Install dependencies
9
- RUN pip install --no-cache-dir -r requirements.txt
 
10
 
11
- # Set up a new user named "user" with user ID 1000
12
  RUN useradd -m -u 1000 user
13
 
14
- # Switch to the "user" user
15
  USER user
16
 
17
- # Set home to the user's home directory
18
  ENV HOME=/home/user \
19
- PATH=/home/user/.local/bin:$PATH
20
 
21
- # Set the working directory to the user's home directory
22
  WORKDIR $HOME/app
23
 
24
- # Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
25
- RUN pip install --no-cache-dir --upgrade pip
26
-
27
- # Copy the current directory contents into the container at $HOME/app setting the owner to the user
28
- COPY --chown=user . $HOME/app
29
 
30
  # Expose the port used by HF Spaces
31
  EXPOSE 7860
 
1
+ # Use python:3.10.9-slim as the base image
2
  FROM python:3.10.9-slim
3
 
4
+ # Install build dependencies for pyaudio
5
+ RUN apt-get update && apt-get install -y --no-install-recommends \
6
+ gcc \
7
+ python3-dev \
8
+ portaudio19-dev \
9
+ && apt-get clean \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Set working directory
13
  WORKDIR /app
14
 
15
+ # Copy requirements.txt first to leverage Docker caching
16
+ COPY requirements.txt .
17
 
18
+ # Upgrade pip and install dependencies as root
19
+ RUN pip install --no-cache-dir --upgrade pip && \
20
+ pip install --no-cache-dir -r requirements.txt
21
 
22
+ # Create a non-root user with UID 1000
23
  RUN useradd -m -u 1000 user
24
 
25
+ # Switch to the non-root user
26
  USER user
27
 
28
+ # Set environment variables for the user
29
  ENV HOME=/home/user \
30
+ PATH=/home/user/.local/bin:$PATH
31
 
32
+ # Set working directory to the user's home directory
33
  WORKDIR $HOME/app
34
 
35
+ # Copy project files and set ownership to the user
36
+ COPY --chown=user:user . .
 
 
 
37
 
38
  # Expose the port used by HF Spaces
39
  EXPOSE 7860
README.md CHANGED
@@ -1 +1,12 @@
1
- "# AI-Voice-Secretary"
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: AI VoiceSecretary
3
+ emoji: 📈
4
+ colorFrom: yellow
5
+ colorTo: green
6
+ sdk: docker
7
+ pinned: false
8
+ license: mit
9
+ ---
10
+
11
+
12
+ # AI-Voice-Secretary