refactor: remove legacy support from Docker and Makefile

Dockerfile changes:
- Replace pip with uv package manager for faster builds
- Remove build-essential and git dependencies
- Use pyproject.toml instead of requirements.txt
- Add uv installation and virtual environment setup
- Modernize environment variables and caching
- Fix hadolint warnings (add --no-install-recommends and pipefail)

Makefile changes:
- Remove docker-build-legacy target (legacy builder)
- Remove docker-dev-host and docker-prod-host targets (networking workarounds)
- Remove docker-reset target (networking fixes)
- Remove docker-clean-legacy target (duplicate functionality)
- Clean up help output and reduce maintenance overhead

This modernizes the build system and removes workarounds for older Docker versions and networking issues.
This commit is contained in:
William Valentin
2025-09-14 17:29:21 -07:00
parent 00a71165ac
commit 1fb8168b6a
2 changed files with 20 additions and 33 deletions

View File

@@ -1,21 +1,24 @@
# UnitForge Docker Image
# Simple build for development and production
# Modern build for development and production
FROM python:3.11-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
UV_CACHE_DIR=/tmp/uv-cache \
UV_PYTHON=python3
# Install system dependencies
RUN apt-get update && apt-get install -y \
# Install system dependencies and uv
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
git \
build-essential \
&& curl -LsSf https://astral.sh/uv/install.sh | sh \
&& rm -rf /var/lib/apt/lists/*
# Add uv to PATH
ENV PATH="/root/.cargo/bin:$PATH"
# Create app user
RUN groupadd --gid 1000 app && \
useradd --uid 1000 --gid app --shell /bin/bash --create-home app
@@ -23,9 +26,12 @@ RUN groupadd --gid 1000 app && \
# Set work directory
WORKDIR /app
# Copy dependency files and install Python dependencies
COPY backend/requirements.txt backend/
RUN pip install --no-cache-dir -r backend/requirements.txt
# Copy dependency files
COPY pyproject.toml uv.lock ./
# Install dependencies with uv
RUN uv venv && \
uv pip install -e ".[web]"
# Copy source code
COPY . .
@@ -38,6 +44,9 @@ RUN chown -R app:app /app
USER app
# Activate virtual environment
ENV PATH="/app/.venv/bin:$PATH"
EXPOSE 8000
# Default command for development