Spaces:
Runtime error
Runtime error
Merge branch 'main' of https://huggingface.co/spaces/Vivek0912/GenAiEmailClassification
Browse files- Dockerfile +12 -0
Dockerfile
CHANGED
|
@@ -17,8 +17,20 @@ COPY backend /app
|
|
| 17 |
# Install dependencies
|
| 18 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
# Ensure correct permissions (optional but recommended)
|
| 21 |
RUN chown -R root:root /app
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
# Start the FastAPI application
|
| 24 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 17 |
# Install dependencies
|
| 18 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
| 20 |
+
# Create a non-root user
|
| 21 |
+
RUN useradd -m -u 1000 user
|
| 22 |
+
|
| 23 |
+
# Create a writable directory for attachments and assign ownership to the non-root user
|
| 24 |
+
USER root
|
| 25 |
+
RUN mkdir -p /data/attachments && chown -R user:user /data/attachments
|
| 26 |
+
|
| 27 |
# Ensure correct permissions (optional but recommended)
|
| 28 |
RUN chown -R root:root /app
|
| 29 |
|
| 30 |
+
# Switch to the non-root user
|
| 31 |
+
USER user
|
| 32 |
+
ENV HOME=/home/user \
|
| 33 |
+
PATH=/home/user/.local/bin:$PATH
|
| 34 |
+
|
| 35 |
# Start the FastAPI application
|
| 36 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|