Update Dockerfile
Browse files- Dockerfile +10 -2
Dockerfile
CHANGED
|
@@ -12,8 +12,12 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 12 |
# Copy application code
|
| 13 |
COPY . .
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
# Hugging Face Spaces runs as user 1000
|
| 16 |
RUN useradd -m -u 1000 user
|
|
|
|
| 17 |
USER user
|
| 18 |
|
| 19 |
# Set PATH for user
|
|
@@ -22,6 +26,10 @@ ENV PATH="/home/user/.local/bin:$PATH"
|
|
| 22 |
# Expose port 7860 (Hugging Face Spaces default)
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
|
|
|
| 12 |
# Copy application code
|
| 13 |
COPY . .
|
| 14 |
|
| 15 |
+
# Make startup script executable
|
| 16 |
+
RUN chmod +x start.sh
|
| 17 |
+
|
| 18 |
# Hugging Face Spaces runs as user 1000
|
| 19 |
RUN useradd -m -u 1000 user
|
| 20 |
+
RUN chown -R user:user /app
|
| 21 |
USER user
|
| 22 |
|
| 23 |
# Set PATH for user
|
|
|
|
| 26 |
# Expose port 7860 (Hugging Face Spaces default)
|
| 27 |
EXPOSE 7860
|
| 28 |
|
| 29 |
+
# Health check
|
| 30 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
| 31 |
+
CMD python3 -c "import requests; requests.get('http://localhost:7860/health')" || exit 1
|
| 32 |
+
|
| 33 |
+
# Start server
|
| 34 |
+
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "info"]
|
| 35 |
|