Spaces:
Sleeping
Sleeping
Download Dockerfile from ISHASI/face-recognition: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/spaces/ISHASI/face-recognition/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/ISHASI/face-recognition/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/ISHASI/face-recognition/resolve/main/Dockerfile
1.22 kB
| # Gunakan image sistem operasi Linux dengan Python 3.10 | |
| FROM python:3.10-slim | |
| # Hugging Face Spaces mewajibkan aplikasi berjalan di bawah user ID 1000 | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Set lokasi direktori kerja di dalam kontainer | |
| WORKDIR /app | |
| # Pindah sementara ke akses root untuk menginstal dependensi tingkat OS | |
| USER root | |
| # PERUBAHAN: Mengganti libgl1-mesa-glx dengan libgl1 agar kompatibel dengan Debian terbaru | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Kembalikan hak milik direktori ke user 1000 | |
| RUN chown -R user:user /app | |
| USER user | |
| # Salin file requirements dan instal library Python | |
| COPY --chown=user:user requirements.txt /app/ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Salin seluruh kode aplikasi (main.py) | |
| COPY --chown=user:user . /app/ | |
| # Buat folder face_db dan berikan izin tulis (write permission) penuh | |
| RUN mkdir -p /app/face_db && chmod -R 777 /app/face_db | |
| # Buka port wajib dari Hugging Face | |
| EXPOSE 7860 | |
| # Perintah untuk menyalakan server uvicorn di port 7860 | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |