Update Dockerfile
Browse files- Dockerfile +17 -10
Dockerfile
CHANGED
|
@@ -4,20 +4,27 @@ FROM python:3.10-slim
|
|
| 4 |
# Set the working directory inside the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Install system dependencies
|
| 8 |
-
RUN apt-get update && apt-get install -y
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
RUN useradd user
|
| 13 |
USER user
|
|
|
|
|
|
|
| 14 |
ENV HOME=/home/user \
|
| 15 |
-
|
| 16 |
|
|
|
|
| 17 |
WORKDIR $HOME/app
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
-
RUN pip install -
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
| 4 |
# Set the working directory inside the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Install system dependencies
|
| 8 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 9 |
+
build-essential \
|
| 10 |
+
git \
|
| 11 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
+
# Create a non-root user
|
| 14 |
+
RUN useradd -m user
|
|
|
|
| 15 |
USER user
|
| 16 |
+
|
| 17 |
+
# Set environment variables
|
| 18 |
ENV HOME=/home/user \
|
| 19 |
+
PATH=/home/user/.local/bin:$PATH
|
| 20 |
|
| 21 |
+
# Set up app directory
|
| 22 |
WORKDIR $HOME/app
|
| 23 |
+
COPY --chown=user . $HOME/app
|
| 24 |
|
| 25 |
+
# Install Python dependencies
|
| 26 |
+
RUN pip install --no-cache-dir --upgrade pip \
|
| 27 |
+
&& pip install --no-cache-dir -r requirements.txt
|
| 28 |
|
| 29 |
+
# Run the FastAPI server using uvicorn
|
| 30 |
+
CMD ["uvicorn", "main:app", "--reload", "--host", "0.0.0.0", "--port", "7860"]
|