Files
tradingagents/Dockerfile
Yijia-Xiao 704b7627f2 fix(docker): pre-create .tradingagents dir with appuser ownership
useradd --create-home creates /home/appuser but not the
.tradingagents subdir, so cache writes fail with PermissionError
when docker-compose mounts a named volume there (the volume
inherits image-dir ownership on first init).

#627 #672 #771 #690 #714 #723 #780 #633 #773 #631
2026-05-11 01:34:45 +00:00

29 lines
606 B
Docker

FROM python:3.12-slim AS builder
ENV PYTHONDONTWRITEBYTECODE=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
WORKDIR /build
COPY . .
RUN pip install --no-cache-dir .
FROM python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
COPY --from=builder /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN useradd --create-home appuser \
&& install -d -m 0755 -o appuser -g appuser /home/appuser/.tradingagents
USER appuser
WORKDIR /home/appuser/app
COPY --from=builder --chown=appuser:appuser /build .
ENTRYPOINT ["tradingagents"]