fix: vendor-based Docker build, playwright upgrade, and CI cross-repo checkout
Some checks failed
Build and Push Docker Image / build (push) Failing after 34s

- Dockerfile now installs schwab-scraper from vendor/ dir (no git needed)
- Upgrade playwright to latest to match browserless chromium container
- CI workflow checks out schwab-scraper into vendor/ before build
- Add scripts/build.sh for local builds via docker-test
- Add curl to runtime image for compose healthcheck
- Increase memory limit to 512M for large account position scraping
This commit is contained in:
2026-04-25 01:16:55 +00:00
parent 9b453e5bb6
commit 61073b2b69
5 changed files with 56 additions and 21 deletions

View File

@@ -2,39 +2,31 @@ FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
WORKDIR /app
ARG GIT_TOKEN=""
RUN if [ -n "$GIT_TOKEN" ]; then \
git config --global url."https://gitea.ext.ben.io/".insteadOf "ssh://gitea@git.local.ben.io/" && \
git config --global --add url."https://gitea.ext.ben.io/".insteadOf "ssh://git.local.ben.io/" && \
echo "machine gitea.ext.ben.io login b3nw password ${GIT_TOKEN}" > /root/.netrc && \
chmod 600 /root/.netrc; \
fi
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev --no-install-project
COPY vendor/schwab-scraper /tmp/schwab-scraper
# Install schwab-scraper from vendored source, then all other deps.
# We strip the git dependency from pyproject.toml so uv doesn't try to fetch it.
RUN uv venv && \
uv pip install /tmp/schwab-scraper && \
sed -i '/schwab-scraper/d' pyproject.toml && \
uv pip install -r pyproject.toml && \
uv pip install --upgrade playwright && \
rm -rf /tmp/schwab-scraper
COPY . .
RUN uv sync --frozen --no-dev
FROM python:3.12-slim-bookworm
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy the environment from the builder
COPY --from=builder /app /app
# Set up environment variables
ENV PATH="/app/.venv/bin:$PATH"
ENV PORT=8000
# Expose the port
EXPOSE 8000
# Run the server
CMD ["python", "server.py"]