NitinBot001 commited on
Commit
25332d7
·
verified ·
1 Parent(s): cb6099e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -0
Dockerfile CHANGED
@@ -2,6 +2,11 @@ FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-runtime
2
 
3
  ENV GRADIO_SERVER_PORT=7860
4
  ENV GRADIO_SERVER_NAME="0.0.0.0"
 
 
 
 
 
5
 
6
  # Create mount point and set permissions for persistent storage
7
  RUN mkdir -p /mnt && \
@@ -17,6 +22,17 @@ COPY requirements.txt requirements.txt
17
  RUN apt-get update && apt-get install -y git && \
18
  pip install -r requirements.txt
19
 
 
 
 
 
 
 
 
 
 
 
 
20
  # Copy application files
21
  COPY app.py .
22
  COPY public/ /opt/app/public/
 
2
 
3
  ENV GRADIO_SERVER_PORT=7860
4
  ENV GRADIO_SERVER_NAME="0.0.0.0"
5
+ # Set environment variables
6
+ ENV PYTHONUNBUFFERED=1
7
+ ENV PYTHONDONTWRITEBYTECODE=1
8
+ ENV GRADIO_SERVER_PORT=7860
9
+ ENV HF_HOME=/app/.cache/huggingface
10
 
11
  # Create mount point and set permissions for persistent storage
12
  RUN mkdir -p /mnt && \
 
22
  RUN apt-get update && apt-get install -y git && \
23
  pip install -r requirements.txt
24
 
25
+ # Create a non-root user for better security
26
+ RUN useradd -m -u 1000 appuser && \
27
+ mkdir -p /app/.cache/huggingface && \
28
+ mkdir -p /tmp/gradio_cache && \
29
+ mkdir -p /app/temp_audio && \
30
+ chown -R appuser:appuser /app && \
31
+ chown -R appuser:appuser /tmp/gradio_cache
32
+
33
+ # Switch to non-root user
34
+ USER appuser
35
+
36
  # Copy application files
37
  COPY app.py .
38
  COPY public/ /opt/app/public/