Files
unitforge/Dockerfile
William Valentin 860f60591c Fix contrast issues with text-muted and bg-dark classes
- Fixed Bootstrap bg-dark class to use better contrasting color
- Added comprehensive text-muted contrast fixes for various contexts
- Improved dark theme colors for better accessibility
- Fixed CSS inheritance issues for code elements in dark contexts
- All color choices meet WCAG AA contrast requirements
2025-09-14 14:58:35 -07:00

115 lines
2.6 KiB
Docker

# UnitForge Docker Image
# Optimized for uv package manager and production deployment
FROM python:3.11-slim as base
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
git \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Create app user
RUN groupadd --gid 1000 app && \
useradd --uid 1000 --gid app --shell /bin/bash --create-home app
# Set work directory
WORKDIR /app
# Copy dependency files
COPY --chown=app:app pyproject.toml .
COPY --chown=app:app backend/requirements.txt backend/
# Create virtual environment and install dependencies
RUN uv venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN uv pip install -r backend/requirements.txt
# Development stage
FROM base as development
# Install development dependencies
RUN uv pip install -e ".[dev,web]"
# Copy source code
COPY --chown=app:app . .
# Make scripts executable
RUN chmod +x unitforge-cli start-server.sh demo.sh
USER app
EXPOSE 8000
CMD ["./start-server.sh", "--host", "0.0.0.0"]
# Production stage
FROM base as production
# Install only production dependencies
RUN uv pip install -e .
# Copy source code
COPY --chown=app:app backend/ backend/
COPY --chown=app:app frontend/ frontend/
COPY --chown=app:app unitforge-cli .
COPY --chown=app:app start-server.sh .
# Make scripts executable
RUN chmod +x unitforge-cli start-server.sh
# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
USER app
EXPOSE 8000
# Use uvicorn directly (already installed via uv)
CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "8000"]
# Multi-stage build for CLI-only image
FROM python:3.11-slim as cli-only
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Create app user
RUN groupadd --gid 1000 app && \
useradd --uid 1000 --gid app --shell /bin/bash --create-home app
WORKDIR /app
# Copy dependency files
COPY --chown=app:app pyproject.toml .
# Create virtual environment and install minimal CLI dependencies
RUN uv venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN uv pip install click pydantic pyyaml validators
# Copy CLI source code only
COPY --chown=app:app backend/app/core/ backend/app/core/
COPY --chown=app:app backend/cli/ backend/cli/
COPY --chown=app:app unitforge-cli .
RUN chmod +x unitforge-cli
USER app
ENTRYPOINT ["./unitforge-cli"]