Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +14 -4
Dockerfile
CHANGED
|
@@ -1,12 +1,14 @@
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
-
|
| 4 |
# Install git, gcc, and python3-dev
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
git \
|
| 7 |
gcc \
|
| 8 |
python3-dev
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
# Set the working directory inside the container
|
| 11 |
WORKDIR /app
|
| 12 |
|
|
@@ -19,7 +21,17 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 19 |
# Copy the entire contents of the 'app' directory into the container
|
| 20 |
COPY . .
|
| 21 |
|
| 22 |
-
# Change
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
WORKDIR /app
|
| 24 |
|
| 25 |
# Expose port 7000 for the Gradio UI
|
|
@@ -27,5 +39,3 @@ EXPOSE 7000
|
|
| 27 |
|
| 28 |
# Command to run the Gradio UI
|
| 29 |
CMD ["python", "main.py"]
|
| 30 |
-
|
| 31 |
-
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
|
|
|
| 3 |
# Install git, gcc, and python3-dev
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
git \
|
| 6 |
gcc \
|
| 7 |
python3-dev
|
| 8 |
|
| 9 |
+
# Add a new user with UID 1000
|
| 10 |
+
RUN useradd -m -u 1000 user
|
| 11 |
+
|
| 12 |
# Set the working directory inside the container
|
| 13 |
WORKDIR /app
|
| 14 |
|
|
|
|
| 21 |
# Copy the entire contents of the 'app' directory into the container
|
| 22 |
COPY . .
|
| 23 |
|
| 24 |
+
# Change ownership of the '/app' directory to the newly created user
|
| 25 |
+
RUN chown -R user:user /app
|
| 26 |
+
|
| 27 |
+
# Switch to the newly created user
|
| 28 |
+
USER user
|
| 29 |
+
|
| 30 |
+
# Set environment variables
|
| 31 |
+
ENV HOME=/home/user \
|
| 32 |
+
PATH=/home/user/.local/bin:$PATH
|
| 33 |
+
|
| 34 |
+
# Change working directory to the 'app' directory
|
| 35 |
WORKDIR /app
|
| 36 |
|
| 37 |
# Expose port 7000 for the Gradio UI
|
|
|
|
| 39 |
|
| 40 |
# Command to run the Gradio UI
|
| 41 |
CMD ["python", "main.py"]
|
|
|
|
|
|