-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (20 loc) · 882 Bytes
/
Copy pathDockerfile
File metadata and controls
28 lines (20 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
FROM python:3.13-slim
# Non-root user for security
RUN addgroup --system connector && adduser --system --ingroup connector connector
WORKDIR /app
# Install dependencies first (layer cache)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application
COPY . .
# Do not run as root
RUN chown -R connector:connector /app
USER connector
EXPOSE 8000
# Cloud Run polls /health to confirm the container is alive.
# HEALTHCHECK here is for local Docker / docker-compose — Cloud Run uses its own probe.
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" \
|| exit 1
# Production: no --reload, single worker (Cloud Run scales horizontally)
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]