Update Dockerfile
Browse files- Dockerfile +23 -15
Dockerfile
CHANGED
@@ -1,23 +1,31 @@
|
|
1 |
-
|
|
|
2 |
|
3 |
-
#
|
4 |
-
RUN useradd -m -u 1000 user
|
5 |
-
|
|
|
6 |
USER user
|
|
|
7 |
ENV HOME=/home/user \
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
# Set the working directory in the container
|
11 |
-
WORKDIR /app
|
12 |
|
13 |
-
#
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
|
22 |
-
# Run
|
23 |
-
CMD ["python", "
|
|
|
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 |
+
# Set environment variables
|
10 |
ENV HOME=/home/user \
|
11 |
+
PATH=/home/user/.local/bin:$PATH \
|
12 |
+
PYTHONUNBUFFERED=1 \
|
13 |
+
GRADIO_ALLOW_FLAGGING=never \
|
14 |
+
GRADIO_NUM_PORTS=1 \
|
15 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
16 |
+
SYSTEM=spaces
|
17 |
|
18 |
# Set the working directory in the container
|
19 |
+
WORKDIR /app
|
20 |
|
21 |
+
# Copy the current directory contents into the container at /app
|
22 |
+
COPY --chown=user:user . /app
|
23 |
|
24 |
+
# Install any needed packages specified in requirements.txt
|
25 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
26 |
+
|
27 |
+
# Expose the port the app runs on
|
28 |
+
EXPOSE 7860
|
29 |
|
30 |
+
# Run gradio_app.py when the container launches
|
31 |
+
CMD ["python", "gradio_app.py"]
|