Create Dockerfile
Browse files- Dockerfile +29 -0
Dockerfile
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use the official Python image with version 3.9
|
2 |
+
FROM python:3.9
|
3 |
+
|
4 |
+
# Create a new user to run the application
|
5 |
+
RUN useradd -m -u 1000 user
|
6 |
+
|
7 |
+
# Set the user for subsequent commands
|
8 |
+
USER user
|
9 |
+
|
10 |
+
# Update the PATH environment variable
|
11 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
12 |
+
|
13 |
+
# Set the working directory
|
14 |
+
WORKDIR /app
|
15 |
+
|
16 |
+
# Copy the requirements.txt file into the container
|
17 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
18 |
+
|
19 |
+
# Install the dependencies listed in requirements.txt
|
20 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
21 |
+
|
22 |
+
# Copy the entire project into the container
|
23 |
+
COPY --chown=user . /app
|
24 |
+
|
25 |
+
# Expose the application port (7860) for Hugging Face Spaces
|
26 |
+
EXPOSE 7860
|
27 |
+
|
28 |
+
# Set the command to run the application using Uvicorn
|
29 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|