gapura-ai-api / Dockerfile
Muhammad Ridzki Nugraha
Upload Dockerfile with huggingface_hub
f65160e verified
raw
history blame contribute delete
926 Bytes
# Dockerfile untuk deployment AI Model ke Google Cloud Run
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
RUN apt-get update && apt-get install -y \
gcc \
g++ \
libgomp1 \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY api/ ./api/
COPY data/ ./data/
COPY models/ ./models/
COPY training/ ./training/
COPY scripts/ ./scripts/
COPY tests/ ./tests/
# Create necessary directories with permissions
RUN mkdir -p /app/data /app/models /app/logs && \
useradd -m -u 1000 appuser && \
chown -R appuser:appuser /app
USER appuser
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD sh -lc 'curl -f http://localhost:${PORT}/health || exit 1'
CMD ["sh", "-lc", "uvicorn api.main:app --host 0.0.0.0 --port ${PORT:-7860} --workers 2"]