Spaces:
Runtime error
Runtime error
novamysticX
commited on
Commit
•
45ca055
1
Parent(s):
0ec7e8c
Update Dockerfile
Browse files- Dockerfile +14 -0
Dockerfile
CHANGED
@@ -2,6 +2,14 @@ FROM python:3.9-slim
|
|
2 |
|
3 |
WORKDIR /code
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
# Install system dependencies
|
6 |
RUN apt-get update && apt-get install -y \
|
7 |
build-essential \
|
@@ -17,6 +25,12 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
17 |
# Copy the application code
|
18 |
COPY . .
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
# Expose the port the app runs on
|
21 |
EXPOSE 7860
|
22 |
|
|
|
2 |
|
3 |
WORKDIR /code
|
4 |
|
5 |
+
# Create a non-root user
|
6 |
+
RUN useradd -m -u 1000 user
|
7 |
+
|
8 |
+
# Set up cache directory with proper permissions
|
9 |
+
ENV TRANSFORMERS_CACHE=/home/user/.cache/huggingface
|
10 |
+
RUN mkdir -p /home/user/.cache/huggingface && \
|
11 |
+
chown -R user:user /home/user/.cache
|
12 |
+
|
13 |
# Install system dependencies
|
14 |
RUN apt-get update && apt-get install -y \
|
15 |
build-essential \
|
|
|
25 |
# Copy the application code
|
26 |
COPY . .
|
27 |
|
28 |
+
# Change ownership of the working directory
|
29 |
+
RUN chown -R user:user /code
|
30 |
+
|
31 |
+
# Switch to non-root user
|
32 |
+
USER user
|
33 |
+
|
34 |
# Expose the port the app runs on
|
35 |
EXPOSE 7860
|
36 |
|