| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, | |
| # software distributed under the License is distributed on an | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| # KIND, either express or implied. See the License for the | |
| # specific language governing permissions and limitations | |
| # under the License. | |
| # Apache Hamilton is an effort undergoing incubation at The Apache Software | |
| # Foundation (ASF), sponsored by the Apache Incubator. Incubation is required | |
| # of all newly accepted projects until a further review indicates that the | |
| # infrastructure, communications, and decision making process have stabilized | |
| # in a manner consistent with other successful ASF projects. While incubation | |
| # status is not necessarily a reflection of the completeness or stability of | |
| # the code, it does indicate that the project has yet to be fully endorsed by | |
| # the ASF. | |
| FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| UV_COMPILE_BYTECODE=1 \ | |
| UV_LINK_MODE=copy | |
| WORKDIR /code | |
| # Install system dependencies for psycopg2-binary and other compiled packages | |
| # Note: psycopg2-binary includes precompiled PostgreSQL adapter, so libpq-dev | |
| # is technically optional. However, we include it for: | |
| # - Compatibility if switching to psycopg2 (non-binary) in the future | |
| # - Development dependencies that might need PostgreSQL client libraries | |
| # - Better error messages if PostgreSQL connection issues occur | |
| # | |
| # For psycopg v3 (modern replacement), this would still be needed for compilation. | |
| # Current dependencies use psycopg2-binary for Django PostgreSQL support. | |
| RUN apt-get update && apt-get install -y \ | |
| gcc \ | |
| libc-dev \ | |
| libffi-dev \ | |
| libpq-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy uv files for dependency installation | |
| COPY pyproject.toml uv.lock /code/ | |
| # Install dependencies using uv with the lock file | |
| RUN --mount=type=cache,target=/root/.cache/uv \ | |
| uv sync --frozen --no-dev --no-install-project | |
| # Add the virtual environment to PATH | |
| ENV PATH="/code/.venv/bin:$PATH" | |
| COPY . /code/ |