Web3Coders / Dockerfile
KurniaKadir's picture
feat: migrate Web3Coders to FastAPI and Hugging Face LLM
b1754e3
Raw History Blame Contribute Delete
910 Bytes
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN groupadd -r appgroup && useradd -r -g appgroup -m -d /home/appuser -s /bin/bash appuser
# Copy requirements first for better caching
COPY requirements/ ./requirements/
# Install only production dependencies
RUN pip install --no-cache-dir -r requirements/base.txt \
&& pip install --no-cache-dir -r requirements/inference.txt
# Copy application
COPY . .
# Change ownership to non-root user
RUN chown -R appuser:appgroup /app
# Switch to non-root user
USER appuser
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD curl -f http://localhost:7860/api/health || exit 1
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]