MIF_E31230910_MP-HRIS-ML/Dockerfile

32 lines
937 B
Docker

FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install dependencies sistem untuk OpenCV & Build tools
RUN apt-get update && apt-get install -y \
build-essential \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements
COPY requirements.txt .
# Install python libraries
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir gunicorn # Tambahkan gunicorn
# Copy seluruh file project
COPY . .
# Pastikan folder storage tersedia dengan permission yang benar
RUN mkdir -p storage/face_datasets storage/face_models storage/temp
# Buka port (di Flask script kamu pakai 5000, tapi di docker kita arahkan ke 8000 agar konsisten dengan compose)
EXPOSE 8000
# Jalankan menggunakan Gunicorn (4 worker biasanya cukup untuk Ryzen 5600G)
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "4", "app:app"]