Spaces:
Running
Running
File size: 780 Bytes
185186c 70db1ad 185186c 70db1ad 185186c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | FROM python:3.11-slim
# Create app user and directory
RUN useradd -m appuser && \
mkdir -p /app && \
chown appuser:appuser /app
WORKDIR /app
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends curl && \
rm -rf /var/lib/apt/lists/*
COPY --chown=appuser:appuser . .
USER appuser
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=3s \
CMD curl -f https://cronjob-python-backend.hf.space/ping || exit 1
# Single command to run everything
CMD bash -c "python -m uvicorn main:app --host 0.0.0.0 --port 7860 & \
while sleep 300; do \
curl -s https://cronjob-python-backend.hf.space/ping > /dev/null || exit 1; \
done" |