Download Dockerfile from TwanAPI/cc3m: direct link, hf CLI and curl.
- Browser
- Download file 1.45 kB
-
https://huggingface.co/spaces/TwanAPI/cc3m/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/TwanAPI/cc3m/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/TwanAPI/cc3m/resolve/main/Dockerfile
1.45 kB
| FROM python:3.11-slim | |
| # Cài system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl wget git build-essential procps htop nano vim \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Cài Node.js 20 | |
| RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ | |
| && apt-get install -y nodejs \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Cài Go 1.22 | |
| RUN wget -q https://go.dev/dl/go1.22.5.linux-amd64.tar.gz \ | |
| && tar -C /usr/local -xzf go1.22.5.linux-amd64.tar.gz \ | |
| && rm go1.22.5.linux-amd64.tar.gz | |
| ENV PATH="/usr/local/go/bin:${PATH}" | |
| ENV GOPATH="/data/go" | |
| ENV ADMIN_API_URL="https://hugpanel-admin.lab70018.workers.dev" | |
| # Tạo user (HF Spaces yêu cầu user 1000) | |
| RUN useradd -m -u 1000 user | |
| ENV HOME=/home/user | |
| ENV PATH="/home/user/.local/bin:${PATH}" | |
| WORKDIR /app | |
| # Cài Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy source code | |
| COPY . . | |
| # Tạo thư mục data | |
| RUN mkdir -p /data/zones && chown -R user:user /data | |
| # Mở port 7860 (mặc định HF Spaces) | |
| EXPOSE 7860 | |
| # Tạo startup script sửa DNS rồi chạy app (chạy root rồi chuyển sang user) | |
| RUN printf '#!/bin/sh\n\ | |
| printf "nameserver 1.1.1.1\\nnameserver 8.8.8.8\\n" > /etc/resolv.conf 2>/dev/null || true\n\ | |
| exec su - user -s /bin/sh -c "cd /app && python app.py"\n' > /app/start.sh && chmod +x /app/start.sh | |
| CMD ["/app/start.sh"] | |