Spaces:
Build error
Build error
Upload 2 files
Browse files- Dockerfile +44 -0
- start.sh +7 -0
Dockerfile
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# Use an official Python runtime as a parent image
|
| 3 |
+
# Using 3.8 based on TensorFlow 2.4 compatibility
|
| 4 |
+
FROM python:3.8-slim
|
| 5 |
+
|
| 6 |
+
# Set environment variables
|
| 7 |
+
ENV PYTHONDONTWRITEBYTECODE 1
|
| 8 |
+
ENV PYTHONUNBUFFERED 1
|
| 9 |
+
|
| 10 |
+
# Set work directory
|
| 11 |
+
WORKDIR /app
|
| 12 |
+
|
| 13 |
+
# Install system dependencies
|
| 14 |
+
# libgl1-mesa-glx is often needed for opencv (cv2)
|
| 15 |
+
# gcc and python3-dev are needed for building some python packages
|
| 16 |
+
RUN apt-get update && apt-get install -y \
|
| 17 |
+
gcc \
|
| 18 |
+
libgl1-mesa-glx \
|
| 19 |
+
libglib2.0-0 \
|
| 20 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
+
|
| 22 |
+
# Install python dependencies
|
| 23 |
+
COPY requirements.txt /app/
|
| 24 |
+
RUN pip install --upgrade pip
|
| 25 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 26 |
+
|
| 27 |
+
# Copy project
|
| 28 |
+
COPY . /app/
|
| 29 |
+
|
| 30 |
+
# Collect static files
|
| 31 |
+
# RUN python manage.py collectstatic --noinput
|
| 32 |
+
# (Commented out because it might fail without proper static storage config, enables manual run if needed)
|
| 33 |
+
|
| 34 |
+
# Expose port 7860 (Hugging Face Default)
|
| 35 |
+
EXPOSE 7860
|
| 36 |
+
|
| 37 |
+
# Default command (overridden by Render/Docker Compose)
|
| 38 |
+
# Start both the web server and the telegram bot
|
| 39 |
+
# Copy and make the start script executable
|
| 40 |
+
COPY start.sh /app/
|
| 41 |
+
RUN chmod +x /app/start.sh
|
| 42 |
+
|
| 43 |
+
# Start using the script
|
| 44 |
+
CMD ["/app/start.sh"]
|
start.sh
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Start the Telegram Bot in the background
|
| 4 |
+
python manage.py run_telegram_bot &
|
| 5 |
+
|
| 6 |
+
# Start the Web Server in the foreground (so the container stays running)
|
| 7 |
+
exec gunicorn credit_card.wsgi:application --bind 0.0.0.0:7860
|