peace2024 commited on
Commit
dc871e9
·
1 Parent(s): 9fe59b0

docker user

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -2
Dockerfile CHANGED
@@ -7,8 +7,8 @@ WORKDIR /app
7
  # Set environment variables for better performance
8
  ENV PYTHONUNBUFFERED=1 \
9
  PYTHONDONTWRITEBYTECODE=1 \
10
- DEBIAN_FRONTEND=noninteractive \
11
- HOME=/root
12
  # Install system-level dependencies
13
  RUN apt-get update && \
14
  apt-get install -y \
@@ -20,11 +20,23 @@ RUN apt-get update && \
20
  build-essential \
21
  && rm -rf /var/lib/apt/lists/*
22
 
 
 
 
 
 
 
 
 
 
23
  # Configure git to avoid permission issues during HF build
24
  RUN git config --global --add safe.directory /app && \
25
  git config --global user.email "[email protected]" && \
26
  git config --global user.name "peace2024"
27
 
 
 
 
28
  # Copy requirements first to leverage Docker layer caching
29
  COPY requirements-hf.txt .
30
 
 
7
  # Set environment variables for better performance
8
  ENV PYTHONUNBUFFERED=1 \
9
  PYTHONDONTWRITEBYTECODE=1 \
10
+ DEBIAN_FRONTEND=noninteractive
11
+
12
  # Install system-level dependencies
13
  RUN apt-get update && \
14
  apt-get install -y \
 
20
  build-essential \
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
+ # Create non-root user to avoid git permission issues
24
+ RUN useradd -m appuser && chown -R appuser /app
25
+
26
+ # Set HOME explicitly to match the non-root user
27
+ ENV HOME=/home/appuser
28
+
29
+ # Switch to appuser for git config
30
+ USER appuser
31
+
32
  # Configure git to avoid permission issues during HF build
33
  RUN git config --global --add safe.directory /app && \
34
  git config --global user.email "[email protected]" && \
35
  git config --global user.name "peace2024"
36
 
37
+ # Switch back to root to install dependencies
38
+ USER root
39
+
40
  # Copy requirements first to leverage Docker layer caching
41
  COPY requirements-hf.txt .
42