# Use Python 3.12 slim image as base
FROM python:3.12-slim
# Set working directory
WORKDIR /app
# Install uv package manager
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
export PATH="/root/.cargo/bin:$PATH"
# Copy project files
COPY pyproject.toml .
COPY uv.lock .
COPY src src
COPY config config
COPY README.md .
# Install dependencies using uv
RUN /root/.cargo/bin/uv pip install --system --no-cache-dir -r <(uv pip compile pyproject.toml)
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app/src
# Run the weather server
CMD ["/root/.cargo/bin/uv", "run", "-m", "weather.main"]