Spaces:
Running
Running
Commit
·
57d51b7
1
Parent(s):
9b23f6f
Fix permission issues for HF Space Dev mode
Browse files- Create user with home directory for git config
- Switch to non-root user to avoid permission issues
- Use --chown flag when copying files
- This should fix the gitconfig permission denied error
- Dockerfile +8 -2
Dockerfile
CHANGED
|
@@ -6,14 +6,20 @@ RUN apt-get update && apt-get install -y \
|
|
| 6 |
git \
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
# Copy and install requirements
|
| 12 |
-
COPY requirements.txt .
|
| 13 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
|
| 15 |
# Copy application code
|
| 16 |
-
COPY app.py .
|
| 17 |
|
| 18 |
EXPOSE 7860
|
| 19 |
|
|
|
|
| 6 |
git \
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
+
# Create a user with home directory for git config
|
| 10 |
+
RUN useradd -m -u 1000 user
|
| 11 |
+
USER user
|
| 12 |
+
ENV HOME=/home/user \
|
| 13 |
+
PATH=/home/user/.local/bin:$PATH
|
| 14 |
+
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
# Copy and install requirements
|
| 18 |
+
COPY --chown=user requirements.txt .
|
| 19 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
|
| 21 |
# Copy application code
|
| 22 |
+
COPY --chown=user app.py .
|
| 23 |
|
| 24 |
EXPOSE 7860
|
| 25 |
|