Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +14 -11
Dockerfile
CHANGED
@@ -1,18 +1,21 @@
|
|
1 |
-
# Use an official lightweight Python image
|
2 |
FROM python:3.9-slim
|
3 |
|
4 |
-
# Set the working directory in the container
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
# Copy
|
8 |
-
COPY requirements.txt .
|
9 |
-
RUN pip install --upgrade
|
10 |
|
11 |
-
#
|
12 |
-
|
|
|
|
|
|
|
13 |
|
14 |
-
#
|
15 |
-
|
|
|
16 |
|
17 |
-
#
|
18 |
-
|
|
|
|
|
|
1 |
FROM python:3.9-slim
|
2 |
|
|
|
3 |
WORKDIR /app
|
4 |
|
5 |
+
# Copy and install requirements
|
6 |
+
COPY requirements.txt /app/requirements.txt
|
7 |
+
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
8 |
|
9 |
+
# Set up a new non-root user
|
10 |
+
RUN useradd -m -u 1000 user
|
11 |
+
USER user
|
12 |
+
ENV HOME=/home/user
|
13 |
+
ENV PATH=/home/user/.local/bin:$PATH
|
14 |
|
15 |
+
# Create a cache directory and set environment variable
|
16 |
+
RUN mkdir -p /home/user/.cache && chown -R user:user /home/user/.cache
|
17 |
+
ENV HF_HOME=/home/user/.cache
|
18 |
|
19 |
+
# Set working directory to the user's app directory
|
20 |
+
WORKDIR $HOME/app
|
21 |
+
COPY --chown=user . $HOME/app
|