-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (34 loc) · 1.19 KB
/
Dockerfile
File metadata and controls
47 lines (34 loc) · 1.19 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
# Forge SDLC Orchestrator
# Multi-stage build for optimized production image
FROM python:3.11-slim as builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY pyproject.toml ./
RUN pip install --no-cache-dir build && \
pip wheel --no-cache-dir --wheel-dir /wheels -e .
# Production stage
FROM python:3.11-slim
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --create-home --shell /bin/bash forge
# Copy wheels and install
COPY --from=builder /wheels /wheels
RUN pip install --no-cache-dir /wheels/* && rm -rf /wheels
# Copy application code
COPY src/ ./src/
# Switch to non-root user
USER forge
# Expose webhook gateway port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import httpx; httpx.get('http://localhost:8000/api/v1/health')" || exit 1
# Default command: run the webhook gateway
CMD ["uvicorn", "forge.main:app", "--host", "0.0.0.0", "--port", "8000"]