Spaces:
Running
Running
feat: fixed it
Browse files- Dockerfile +20 -7
Dockerfile
CHANGED
|
@@ -1,17 +1,30 @@
|
|
| 1 |
-
#
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
FROM python:3.9
|
| 5 |
|
|
|
|
| 6 |
RUN useradd -m -u 1000 user
|
| 7 |
USER user
|
|
|
|
|
|
|
| 8 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 9 |
|
|
|
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
RUN python -m spacy download en_core_web_sm
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
| 1 |
+
# Use a slim base image for smaller footprint
|
| 2 |
+
FROM python:3.9-slim
|
|
|
|
|
|
|
| 3 |
|
| 4 |
+
# Create a non-root user
|
| 5 |
RUN useradd -m -u 1000 user
|
| 6 |
USER user
|
| 7 |
+
|
| 8 |
+
# Set environment path
|
| 9 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 10 |
|
| 11 |
+
# Set working directory
|
| 12 |
WORKDIR /app
|
| 13 |
|
| 14 |
+
# Copy and install dependencies
|
| 15 |
+
COPY --chown=user requirements.txt requirements.txt
|
| 16 |
+
RUN pip install --no-cache-dir --upgrade pip \
|
| 17 |
+
&& pip install --no-cache-dir -r requirements.txt
|
| 18 |
+
|
| 19 |
+
# Optional: download SpaCy model in one layer
|
| 20 |
RUN python -m spacy download en_core_web_sm
|
| 21 |
|
| 22 |
+
# Copy the full project
|
| 23 |
+
COPY --chown=user . .
|
| 24 |
+
|
| 25 |
+
# Expose the port (optional for clarity)
|
| 26 |
+
EXPOSE 7860
|
| 27 |
+
|
| 28 |
+
# Run the app
|
| 29 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 30 |
+
|