Spaces:
Paused
Paused
File size: 1,095 Bytes
b371d4a |
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 32 33 34 35 36 37 38 39 40 41 42 |
# Use lightweight Python image
FROM python:3.10-slim
# Environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
ca-certificates \
# lklklkl
&& rm -rf /var/lib/apt/lists/*
# Install cloudflared (NO sudo, NO service install)
RUN curl -fsSL https://pkg.cloudflare.com/cloudflare-public-v2.gpg \
| tee /usr/share/keyrings/cloudflare-public-v2.gpg >/dev/null && \
echo "deb [signed-by=/usr/share/keyrings/cloudflare-public-v2.gpg] https://pkg.cloudflare.com/cloudflared any main" \
| tee /etc/apt/sources.list.d/cloudflared.list && \
apt-get update && \
apt-get install -y cloudflared && \
rm -rf /var/lib/apt/lists/*
# Copy requirements first (better caching)
COPY requirements.txt .
# Install Python deps
RUN pip install --no-cache-dir -r requirements.txt
# Copy app
COPY app.py .
# Expose HF port
EXPOSE 7860
# Start Flask + cloudflared together
CMD cloudflared tunnel run --token $CLOUDFLARED_TOKEN & python app.py
|