first build attempt
Build and Push Image / Build and push image (push) Failing after 1m58s

This commit is contained in:
2026-05-19 23:24:27 +10:00
parent b436a81300
commit bf6fe21ea6
27 changed files with 449 additions and 634 deletions
+34 -40
View File
@@ -1,5 +1,5 @@
# Stage 1: Base with system dependencies and tool installations
FROM python:3.12-slim as builder
# Stage 1: Builder
FROM python:3.12-slim AS builder
# Install system dependencies
RUN apt-get update && apt-get install -y \
@@ -7,58 +7,52 @@ RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Hadolint (for Dockerfile linting)
RUN curl -Lo /bin/hadolint https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64 && \
chmod +x /bin/hadolint
# Install Checkov (for Kubernetes security scanning)
RUN pip install checkov
# Install Trivy (for container and IaC scanning) - Native MCP server
# Install Tools
RUN curl -Lo /bin/hadolint https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64 && chmod +x /bin/hadolint
RUN pip install checkov semgrep
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
# Install Semgrep (for code scanning) - Will use native MCP server
RUN pip install semgrep
# Install UV package manager
# Install UV
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Stage 2: App with source code and UV sync
WORKDIR /app
COPY pyproject.toml .
# Create virtual environment and install dependencies
RUN uv venv /opt/venv
RUN uv pip install --python /opt/venv/bin/python .
# Stage 2: Final
FROM python:3.12-slim
# Create non-root user
RUN useradd --create-home --shell /bin/bash app
WORKDIR /app
USER app
# Install runtime dependencies
# Install system dependencies needed at runtime
RUN apt-get update && apt-get install -y \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy UV from builder stage
COPY --from=builder /bin/uv /bin/uv
COPY --from=builder /bin/uvx /bin/uvx
# Create non-root user
RUN useradd --create-home --shell /bin/bash app
WORKDIR /app
# Copy virtual environment and tools from builder
COPY --from=builder /opt/venv /opt/venv
COPY --from=builder /bin/hadolint /bin/hadolint
# Copy other tools if needed (Trivy, etc.)
COPY --from=builder /usr/local/bin/trivy /usr/local/bin/trivy
# Copy application code
COPY --chown=app:app pyproject.toml .
COPY --chown=app:app README.md .
COPY --chown=app:app src/ ./src/
COPY --chown=app:app mcp_servers/ ./mcp_servers/
COPY --chown=app:app crews/ ./crews/
COPY --chown=app:app tools/ ./tools/
COPY --chown=app:app config/ ./config/
COPY --chown=app:app contexts/ ./contexts/
COPY src/ ./src/
COPY mcp_servers/ ./mcp_servers/
COPY crews/ ./crews/
COPY tools/ ./tools/
COPY config/ ./config/
COPY contexts/ ./contexts/
COPY README.md .
# Install Python dependencies using UV
RUN uv sync --frozen --no-dev
# Set the environment variables to use the venv
ENV PATH="/opt/venv/bin:$PATH"
ENV PYTHONPATH="/app/src"
USER app
# Set environment variables
ENV PYTHONPATH=/app/src
ENV PATH="/app/.venv/bin:$PATH"
# Expose port
EXPOSE 8000
# Set entrypoint
ENTRYPOINT ["uvicorn", "src.pr_reviewer.main:app", "--host", "0.0.0.0", "--port", "8000"]