@@ -6,6 +6,17 @@ ENV LANGUAGE en_US:en
66ENV LC_ALL en_US.UTF-8
77ENV PYTHONUNBUFFERED 1
88
9+ # uv environment variables
10+ # Copy (don't hardlink) files into /.venv. Avoid issues with Docker's FS
11+ # https://docs.astral.sh/uv/reference/environment/
12+ ENV UV_LINK_MODE=copy
13+ ENV UV_PYTHON_DOWNLOADS=never
14+ ENV UV_PROJECT_ENVIRONMENT=/.venv
15+
16+ # Pep668 prevents pip from modifying system packages
17+ # https://peps.python.org/pep-0668/
18+ ENV PIP_BREAK_SYSTEM_PACKAGES=1
19+
920RUN apt-get -y update
1021RUN apt-get -y install \
1122 curl \
@@ -23,45 +34,47 @@ RUN apt-get -y install \
2334 libmysqlclient-dev \
2435 libfreetype6 \
2536 libjpeg-dev \
26- sqlite \
37+ sqlite3 \
2738 netcat-openbsd \
2839 telnet \
2940 lsb-release
3041
3142# Install uv for fast package management
32- RUN curl -LsSf https://astral.sh/uv/install.sh | sh
33- ENV PATH="/root/.cargo/bin:${PATH}"
43+ # https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
44+ ADD https://astral.sh/uv/install.sh /uv-installer.sh
45+ RUN sh /uv-installer.sh && rm /uv-installer.sh
46+ ENV PATH="/root/.local/bin/:$PATH"
3447
3548# Copy project files for dependency resolution
3649# uv.lock ensures reproducible builds
3750COPY pyproject.toml uv.lock ./
3851
3952# Install dependencies using uv sync
53+ # This creates a virtual environment at /.venv (not in /app)
4054# This installs all dependencies from uv.lock, ensuring consistency
4155# --frozen: Don't update the lockfile
42- # --no-install-project: Don't install the project itself (we'll copy source later)
43- # By default, installs base dependencies + dev group (for development container)
56+ # --no-install-project: Don't install the project itself
57+ # If you do not want the analyzer dependencies (which are LARGE), you can use:
58+ # RUN --mount=type=cache,target=/root/.cache/uv \
59+ # uv sync --frozen --no-install-project --extra dev --extra production
4460RUN --mount=type=cache,target=/root/.cache/uv \
4561 uv sync --frozen --no-install-project --all-extras
4662
47- # For production builds, you can use:
48- # RUN --mount=type=cache,target=/root/.cache/uv \
49- # uv sync --frozen --no-install-project --no-dev --extra production --extra analyzer
50-
5163COPY ./docker-compose/django/start /start
5264RUN chmod +x /start
5365
66+ # Launch a shell within the container with this script
67+ COPY ./docker-compose/django/shell /shell
68+ RUN chmod +x /shell
69+
5470COPY ./docker-compose/django/celery/worker/start /start-celeryworker
5571RUN chmod +x /start-celeryworker
5672
5773COPY ./docker-compose/django/celery/beat/start /start-celerybeat
5874RUN chmod +x /start-celerybeat
5975
60- # Ensure that ``python`` is in the PATH so that ``./manage.py`` works
61- RUN ln -s /usr/bin/python3 /usr/bin/python
62-
6376# Load model
64- RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('multi-qa-MiniLM-L6-cos-v1', cache_folder='/tmp/sentence_transformers')"
77+ RUN uv run python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('multi-qa-MiniLM-L6-cos-v1', cache_folder='/tmp/sentence_transformers')"
6578
6679# Setup the locale
6780RUN locale-gen en_US.UTF-8
0 commit comments