Update Dockerfile
Browse files- Dockerfile +24 -8
Dockerfile
CHANGED
|
@@ -1,20 +1,36 @@
|
|
| 1 |
-
FROM python:3.
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
-
|
| 7 |
curl \
|
| 8 |
git \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
|
| 14 |
-
|
|
|
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
|
|
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
|
| 3 |
+
# Set working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
+
# Install system dependencies
|
| 7 |
RUN apt-get update && apt-get install -y \
|
| 8 |
+
gcc \
|
| 9 |
curl \
|
| 10 |
git \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
+
# Clone
|
| 14 |
+
RUN git clone https://github.com/gzzhongqi/geminicli2api.git /app
|
| 15 |
|
| 16 |
+
# Install Python dependencies
|
| 17 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 18 |
|
| 19 |
+
# Create non-root user for security
|
| 20 |
+
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
|
| 21 |
+
USER appuser
|
| 22 |
|
| 23 |
+
# Expose ports (8888 for compatibility, 7860 for Hugging Face)
|
| 24 |
+
EXPOSE 8888 7860
|
| 25 |
|
| 26 |
+
# Set environment variables
|
| 27 |
+
ENV PYTHONPATH=/app
|
| 28 |
+
ENV HOST=0.0.0.0
|
| 29 |
+
ENV PORT=7860
|
| 30 |
+
|
| 31 |
+
# Health check (use PORT environment variable)
|
| 32 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
| 33 |
+
CMD curl -f http://localhost:${PORT}/health || exit 1
|
| 34 |
+
|
| 35 |
+
# Run the application using app.py (Hugging Face compatible entry point)
|
| 36 |
+
CMD ["python", "app.py"]
|