Files
unitforge/Dockerfile
William Valentin 4132399533 fix: resolve uv installation in Docker container
- Fix uv installation path from /root/.cargo/bin to /root/.local/bin
- Move uv and uvx binaries to /usr/local/bin for all users
- Fix build order to copy source before installing package
- Container now starts successfully with uv available
2025-09-14 19:36:31 -07:00

50 lines
1.2 KiB
Docker

# UnitForge Docker Image
# Modern build for development and production
FROM python:3.11-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
UV_CACHE_DIR=/tmp/uv-cache \
UV_PYTHON=python3
# Install system dependencies and uv
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& curl -LsSf https://astral.sh/uv/install.sh | sh \
&& mv /root/.local/bin/uv /usr/local/bin/uv \
&& mv /root/.local/bin/uvx /usr/local/bin/uvx \
&& rm -rf /var/lib/apt/lists/* /root/.local
# 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 source code
COPY . .
# Install dependencies with uv
RUN uv venv && \
uv pip install -e ".[web]"
# Make scripts executable
RUN chmod +x unitforge-cli start-server.sh demo.sh 2>/dev/null || true
# Change ownership
RUN chown -R app:app /app
USER app
# Activate virtual environment
ENV PATH="/app/.venv/bin:$PATH"
EXPOSE 8000
# Default command for development
CMD ["./start-server.sh", "--host", "0.0.0.0", "--log-level", "debug"]