imseldrith commited on
Commit
44dc924
·
verified ·
1 Parent(s): 0755d10

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -9
Dockerfile CHANGED
@@ -7,20 +7,19 @@ RUN apt-get update && \
7
  python3 \
8
  python3-pip \
9
  python3-dev \
10
- git \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # Set the working directory
 
 
14
  WORKDIR /app
15
 
16
- # Copy requirements.txt first to leverage Docker layer caching
17
- COPY requirements.txt .
18
-
19
- # Install Python dependencies
20
  RUN pip install --no-cache-dir -r requirements.txt
21
 
22
- # Copy all files from the Hugging Face Space repository
23
- COPY . .
24
 
25
- # Command to run your script
26
  CMD ["python3", "cli.py"]
 
7
  python3 \
8
  python3-pip \
9
  python3-dev \
 
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Create a non-root user and set permissions
13
+ RUN useradd -m appuser && mkdir /app && chown appuser:appuser /app
14
+ USER appuser
15
  WORKDIR /app
16
 
17
+ # Copy requirements.txt and install dependencies
18
+ COPY --chown=appuser:appuser requirements.txt .
 
 
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # Copy the rest of the application code
22
+ COPY --chown=appuser:appuser . .
23
 
24
+ # Run the script
25
  CMD ["python3", "cli.py"]