fixed docker file for dependency installs

This commit is contained in:
michael 2025-10-08 17:06:41 -05:00
parent 1dae163cad
commit 06f958c974

View file

@ -31,10 +31,9 @@ WORKDIR /app
# Copy dependency files
COPY pyproject.toml poetry.lock ./
# Install dependencies (using pip for simpler container)
# Export to requirements.txt and install with pip for smaller image
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes \
&& pip install --no-cache-dir --user -r requirements.txt \
# Install dependencies using Poetry directly (simpler and more reliable)
RUN poetry config virtualenvs.create false \
&& poetry install --only main --no-interaction --no-ansi \
&& rm -rf $POETRY_CACHE_DIR
# -----------------------------------------------------------------------------
@ -54,12 +53,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
RUN groupadd --gid 1000 app \
&& useradd --uid 1000 --gid app --shell /bin/bash --create-home app
# Copy Python packages from builder
COPY --from=builder /root/.local /home/app/.local
# Copy Python packages from builder (installed globally, not in user dir)
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# Set PATH to include user packages
ENV PATH="/home/app/.local/bin:$PATH" \
PYTHONPATH=/app \
# Set environment variables
ENV PYTHONPATH=/app \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1