Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +33 -26
Dockerfile
CHANGED
@@ -1,27 +1,34 @@
|
|
1 |
-
# Use Python as base image
|
2 |
-
FROM python:3.10-slim
|
3 |
-
|
4 |
-
#
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
#
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "main:app", "--bind", "0.0.0.0:8000", "--workers", "4"]
|
|
|
1 |
+
# Use Python as base image
|
2 |
+
FROM python:3.10-slim
|
3 |
+
|
4 |
+
# Install system dependencies
|
5 |
+
USER root
|
6 |
+
RUN apt-get update && apt-get install -y \
|
7 |
+
libgl1-mesa-glx \
|
8 |
+
&& rm -rf /var/lib/apt/lists/*
|
9 |
+
|
10 |
+
# Set environment variables
|
11 |
+
ENV PYTHONUNBUFFERED=1 \
|
12 |
+
PYTHONDONTWRITEBYTECODE=1
|
13 |
+
|
14 |
+
RUN useradd -m -u 1000 user
|
15 |
+
USER user
|
16 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
17 |
+
|
18 |
+
|
19 |
+
# Set the working directory inside the container
|
20 |
+
WORKDIR /app
|
21 |
+
|
22 |
+
|
23 |
+
# Copy the project files into the container
|
24 |
+
COPY . /app
|
25 |
+
|
26 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
27 |
+
# Install Python dependencies
|
28 |
+
RUN pip install --upgrade pip && pip install -r requirements.txt
|
29 |
+
|
30 |
+
# Expose the application's port
|
31 |
+
EXPOSE 8000
|
32 |
+
|
33 |
+
# Start the FastAPI application
|
34 |
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "main:app", "--bind", "0.0.0.0:8000", "--workers", "4"]
|