syntaxhacker commited on
Commit ·
ddc093c
1
Parent(s): 1494675
fix Dockerfile: run pip install as root before switching to user
Browse files- Dockerfile +9 -9
Dockerfile
CHANGED
|
@@ -2,22 +2,22 @@ FROM python:3.11-slim
|
|
| 2 |
|
| 3 |
RUN apt-get update -qq && apt-get install -y -qq git && rm -rf /var/lib/apt/lists/*
|
| 4 |
|
| 5 |
-
RUN useradd -m -u 1000 user
|
| 6 |
-
USER user
|
| 7 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 8 |
-
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
-
# Copy requirements and install dependencies
|
| 12 |
-
COPY
|
| 13 |
-
COPY
|
| 14 |
RUN pip install --no-cache-dir -r requirements.txt && \
|
| 15 |
python -c "import site; import shutil; shutil.copy('scripts/utils_shim.py', f'{site.getsitepackages()[0]}/utils.py')" && \
|
| 16 |
rm -rf scripts
|
| 17 |
|
| 18 |
# Copy application code
|
| 19 |
-
COPY
|
| 20 |
-
COPY
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# Expose HF Space port
|
| 23 |
EXPOSE 7860
|
|
|
|
| 2 |
|
| 3 |
RUN apt-get update -qq && apt-get install -y -qq git && rm -rf /var/lib/apt/lists/*
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Copy requirements and install dependencies (as root)
|
| 8 |
+
COPY requirements.txt .
|
| 9 |
+
COPY scripts/ scripts/
|
| 10 |
RUN pip install --no-cache-dir -r requirements.txt && \
|
| 11 |
python -c "import site; import shutil; shutil.copy('scripts/utils_shim.py', f'{site.getsitepackages()[0]}/utils.py')" && \
|
| 12 |
rm -rf scripts
|
| 13 |
|
| 14 |
# Copy application code
|
| 15 |
+
COPY app/ app/
|
| 16 |
+
COPY prompts/ prompts/
|
| 17 |
+
|
| 18 |
+
RUN useradd -m -u 1000 user && chown -R user:user /app
|
| 19 |
+
USER user
|
| 20 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 21 |
|
| 22 |
# Expose HF Space port
|
| 23 |
EXPOSE 7860
|