Some checks failed
Build and Push Docker Image / build (push) Failing after 19s
The builder image needs git to clone the schwab-scraper SSH dependency. Uses git insteadOf to redirect SSH URLs to HTTPS with CR_PAT in CI.
39 lines
1013 B
Docker
39 lines
1013 B
Docker
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://${GIT_TOKEN}@gitea.ext.ben.io/".insteadOf "ssh://gitea@git.local.ben.io/" && \
|
|
git config --global --add url."https://${GIT_TOKEN}@gitea.ext.ben.io/".insteadOf "ssh://git.local.ben.io/"; \
|
|
fi
|
|
|
|
COPY pyproject.toml uv.lock ./
|
|
RUN uv sync --frozen --no-dev --no-install-project
|
|
|
|
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"]
|