Spaces:
Sleeping
Sleeping
PanagiotisMark
commited on
Commit
•
9ab83af
1
Parent(s):
dcd4f2d
- Dockerfile +16 -9
- requirements.txt +2 -2
Dockerfile
CHANGED
@@ -1,16 +1,26 @@
|
|
1 |
# Use the official Python image from the Docker Hub
|
2 |
FROM python:3.9.19-slim
|
3 |
|
4 |
-
#
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
# Set the working directory in the container
|
10 |
WORKDIR /app
|
11 |
|
12 |
# Copy the current directory contents into the container at /app
|
13 |
-
COPY . /app
|
14 |
|
15 |
# Install any needed packages specified in requirements.txt
|
16 |
RUN pip install --no-cache-dir -r requirements.txt
|
@@ -18,8 +28,5 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
18 |
# Expose the port the app runs on
|
19 |
EXPOSE 7860
|
20 |
|
21 |
-
#
|
22 |
-
ENV PYTHONUNBUFFERED=1
|
23 |
-
|
24 |
-
# Run the application
|
25 |
CMD ["python", "gradio_app.py"]
|
|
|
1 |
# Use the official Python image from the Docker Hub
|
2 |
FROM python:3.9.19-slim
|
3 |
|
4 |
+
# Create the app directory and change its ownership
|
5 |
+
RUN mkdir /app && useradd -m -u 1000 user && chown -R user:user /app
|
6 |
+
|
7 |
+
# Switch to the user
|
8 |
+
USER user
|
9 |
+
|
10 |
+
# Set environment variables
|
11 |
+
ENV HOME=/home/user \
|
12 |
+
PATH=/home/user/.local/bin:$PATH \
|
13 |
+
PYTHONUNBUFFERED=1 \
|
14 |
+
GRADIO_ALLOW_FLAGGING=never \
|
15 |
+
GRADIO_NUM_PORTS=1 \
|
16 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
17 |
+
SYSTEM=spaces
|
18 |
|
19 |
# Set the working directory in the container
|
20 |
WORKDIR /app
|
21 |
|
22 |
# Copy the current directory contents into the container at /app
|
23 |
+
COPY --chown=user:user . /app
|
24 |
|
25 |
# Install any needed packages specified in requirements.txt
|
26 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
28 |
# Expose the port the app runs on
|
29 |
EXPOSE 7860
|
30 |
|
31 |
+
# Run gradio_app.py when the container launches
|
|
|
|
|
|
|
32 |
CMD ["python", "gradio_app.py"]
|
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
gradio
|
2 |
-
requests
|
|
|
1 |
+
gradio
|
2 |
+
requests
|