Spaces:
Sleeping
Sleeping
n0v33n
commited on
Commit
·
29cdf4a
1
Parent(s):
287ab0c
update commit
Browse files- DockerFile +4 -28
DockerFile
CHANGED
|
@@ -1,31 +1,7 @@
|
|
| 1 |
-
# Use official Python slim image
|
| 2 |
FROM python:3.11-slim
|
| 3 |
-
|
| 4 |
-
# Set working dir
|
| 5 |
WORKDIR /app
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
build-essential \
|
| 10 |
-
libjpeg-dev \
|
| 11 |
-
zlib1g-dev \
|
| 12 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
-
|
| 14 |
-
# Copy requirements first for better caching
|
| 15 |
-
COPY requirements.txt /app/
|
| 16 |
-
|
| 17 |
-
# Install python deps
|
| 18 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
-
|
| 20 |
-
# Copy app
|
| 21 |
-
COPY . /app
|
| 22 |
-
|
| 23 |
-
# Expose port (Spaces usually route; commonly 8080 works)
|
| 24 |
EXPOSE 8080
|
| 25 |
-
|
| 26 |
-
# Use a non-root user (optional but nice)
|
| 27 |
-
RUN useradd --create-home appuser && chown -R appuser /app
|
| 28 |
-
USER appuser
|
| 29 |
-
|
| 30 |
-
# Run with Uvicorn
|
| 31 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080", "--workers", "1"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.11-slim
|
|
|
|
|
|
|
| 2 |
WORKDIR /app
|
| 3 |
+
COPY requirements.txt .
|
| 4 |
+
RUN pip install -r requirements.txt
|
| 5 |
+
COPY . .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
EXPOSE 8080
|
| 7 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|