Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +19 -0
Dockerfile
CHANGED
@@ -2,6 +2,17 @@ FROM python:3.11-slim
|
|
2 |
|
3 |
WORKDIR /code
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
# Install system dependencies
|
6 |
RUN apt-get update && apt-get install -y \
|
7 |
gcc \
|
@@ -27,6 +38,14 @@ COPY ./app.py /code/app.py
|
|
27 |
COPY ./templates /code/templates
|
28 |
COPY ./models /code/models
|
29 |
|
|
|
|
|
|
|
|
|
30 |
EXPOSE 7860
|
31 |
|
|
|
|
|
|
|
|
|
32 |
CMD ["python", "app.py"]
|
|
|
2 |
|
3 |
WORKDIR /code
|
4 |
|
5 |
+
# Create cache directory and set permissions
|
6 |
+
RUN mkdir -p /cache && \
|
7 |
+
chmod 777 /cache && \
|
8 |
+
mkdir -p /.cache && \
|
9 |
+
chmod 777 /.cache
|
10 |
+
|
11 |
+
# Set cache environment variables
|
12 |
+
ENV TRANSFORMERS_CACHE=/cache \
|
13 |
+
HF_HOME=/cache \
|
14 |
+
XDG_CACHE_HOME=/cache
|
15 |
+
|
16 |
# Install system dependencies
|
17 |
RUN apt-get update && apt-get install -y \
|
18 |
gcc \
|
|
|
38 |
COPY ./templates /code/templates
|
39 |
COPY ./models /code/models
|
40 |
|
41 |
+
# Set proper permissions for the application
|
42 |
+
RUN chown -R 1000:1000 /code && \
|
43 |
+
chmod -R 755 /code
|
44 |
+
|
45 |
EXPOSE 7860
|
46 |
|
47 |
+
# Create and switch to non-root user
|
48 |
+
RUN useradd -m -u 1000 user
|
49 |
+
USER user
|
50 |
+
|
51 |
CMD ["python", "app.py"]
|