Update Dockerfile
Browse files- Dockerfile +13 -5
Dockerfile
CHANGED
|
@@ -1,18 +1,26 @@
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
COPY . .
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
RUN chmod -R 777 /app
|
| 9 |
-
useradd -m -u 1000 user
|
| 10 |
|
|
|
|
|
|
|
| 11 |
USER user
|
| 12 |
|
| 13 |
-
|
|
|
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
EXPOSE 7860
|
| 16 |
|
| 17 |
-
#
|
| 18 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
+
# Set working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
+
# Copy all project files
|
| 7 |
COPY . .
|
| 8 |
|
| 9 |
+
# Ensure non-root permissions
|
| 10 |
+
RUN chmod -R 777 /app
|
|
|
|
| 11 |
|
| 12 |
+
# Create user with UID 1000 and switch to it
|
| 13 |
+
RUN useradd -m -u 1000 user
|
| 14 |
USER user
|
| 15 |
|
| 16 |
+
# Add user's pip scripts path to PATH
|
| 17 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 18 |
|
| 19 |
+
# Install Python dependencies
|
| 20 |
+
RUN pip install --no-cache-dir --no-warn-script-location -r requirements.txt
|
| 21 |
+
|
| 22 |
+
# Expose port used by FastAPI
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
+
# Start FastAPI app
|
| 26 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|