pos-tagger / Dockerfile
rrayhka's picture
Update Dockerfile
d71e9b0 verified
raw
history blame
822 Bytes
# Gunakan base image dengan Python
FROM python:3.9-slim
# Set environment variable untuk non-interaktif
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV HF_HOME=/app/cache
# Buat direktori kerja untuk aplikasi
WORKDIR /app
# Salin file requirements.txt ke container
COPY requirements.txt /app/
# Install dependencies Python
RUN pip install --no-cache-dir -r requirements.txt
# Buat direktori cache untuk model
RUN mkdir -p /app/cache
# Salin seluruh file aplikasi ke container
COPY . /app/
# Jalankan skrip untuk mengunduh model dari Hugging Face
RUN python download_model.py
# Install gunicorn untuk server produksi
RUN pip install gunicorn
# Ekspos port default Flask (5007)
EXPOSE 5007
# Perintah untuk menjalankan aplikasi dengan Gunicorn
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5007", "app:app"]