Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +11 -12
Dockerfile
CHANGED
|
@@ -1,26 +1,25 @@
|
|
| 1 |
-
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
-
# Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
#
|
|
|
|
|
|
|
|
|
|
| 8 |
RUN useradd -m -u 1000 user
|
| 9 |
USER user
|
| 10 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 11 |
|
| 12 |
-
# Copy
|
| 13 |
-
# Use --chown=user:user to ensure the new user owns the files
|
| 14 |
COPY --chown=user:user requirements.txt .
|
| 15 |
-
|
| 16 |
-
# Install dependencies
|
| 17 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 18 |
|
| 19 |
-
# Copy the rest of the application
|
| 20 |
COPY --chown=user:user . .
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
EXPOSE
|
| 24 |
|
| 25 |
-
# Start
|
| 26 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "
|
|
|
|
| 1 |
+
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
|
|
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
+
# Install system dependencies
|
| 7 |
+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
| 8 |
+
|
| 9 |
+
# Create a non-root user for security
|
| 10 |
RUN useradd -m -u 1000 user
|
| 11 |
USER user
|
| 12 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 13 |
|
| 14 |
+
# Copy and install dependencies
|
|
|
|
| 15 |
COPY --chown=user:user requirements.txt .
|
|
|
|
|
|
|
| 16 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
|
| 18 |
+
# Copy the rest of the application
|
| 19 |
COPY --chown=user:user . .
|
| 20 |
|
| 21 |
+
# Standard OpenEnv port is 8000
|
| 22 |
+
EXPOSE 8000
|
| 23 |
|
| 24 |
+
# Start using uvicorn on port 8000
|
| 25 |
+
CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000"]
|