g4f / Dockerfile
dwfwfwfwf's picture
Update Dockerfile
e717d6a verified
Raw
History Blame Contribute Delete
658 Bytes
FROM python:3.11-slim
# Create user for security
RUN useradd -m -u 1000 user
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir g4f[all]
RUN pip install --no-cache-dir eval_type_backport
RUN pip install a2wsgi Flask
# Copy application files
COPY --chown=user:user app.py .
# Switch to non-root user
USER user
# Set environment variables
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Expose port 7860
EXPOSE 7860
# Run the application
CMD ["python", "app.py"]