Shreekant Kalwar (Nokia)
commited on
Commit
·
6707a85
1
Parent(s):
7a240a4
docker test
Browse files- Dockerfile +6 -11
Dockerfile
CHANGED
|
@@ -1,24 +1,19 @@
|
|
| 1 |
-
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.13
|
| 3 |
|
| 4 |
-
# Set the working directory in the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Copy the current directory contents into the container
|
| 8 |
COPY . .
|
| 9 |
|
| 10 |
-
# Install dependencies
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
|
|
|
|
|
|
|
| 15 |
ENV HF_HOME=/app/.cache
|
|
|
|
| 16 |
|
| 17 |
-
|
| 18 |
-
RUN mkdir -p /app/.cache
|
| 19 |
|
| 20 |
-
# Expose FastAPI port
|
| 21 |
EXPOSE 7860
|
| 22 |
-
|
| 23 |
-
# Run FastAPI app
|
| 24 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.13
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
COPY . .
|
| 6 |
|
|
|
|
| 7 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 8 |
|
| 9 |
+
# Create non-root user
|
| 10 |
+
RUN useradd -m -u 1000 appuser
|
| 11 |
+
|
| 12 |
+
# Hugging Face cache
|
| 13 |
ENV HF_HOME=/app/.cache
|
| 14 |
+
RUN mkdir -p /app/.cache && chown -R appuser:appuser /app
|
| 15 |
|
| 16 |
+
USER appuser
|
|
|
|
| 17 |
|
|
|
|
| 18 |
EXPOSE 7860
|
|
|
|
|
|
|
| 19 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|