-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (36 loc) · 1.17 KB
/
Copy pathDockerfile
File metadata and controls
49 lines (36 loc) · 1.17 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Root Dockerfile (builds kalman-engine)
# This exists so `docker build -t kalman-engine .` works from repo root.
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY kalman-engine/requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Install additional runtime dependencies
RUN pip install \
uvicorn[standard] \
fastapi \
redis \
prometheus-client
# Copy source code
COPY kalman-engine/ ./
# Create non-root user
RUN addgroup --gid 1001 --system kalmanguard && \
adduser --no-create-home --shell /bin/false --disabled-password --uid 1001 --system --group kalmanguard
# Set ownership
RUN chown -R kalmanguard:kalmanguard /app
USER kalmanguard
# Environment variables
ENV PYTHONUNBUFFERED=1
ENV PORT=8000
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Start command
CMD ["python", "-m", "uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000"]