mirror of
https://github.com/ThePhaseless/Byparr.git
synced 2026-09-24 14:20:08 +01:00
47 lines
1.2 KiB
Docker
47 lines
1.2 KiB
Docker
FROM debian:bullseye-slim AS base
|
|
|
|
ARG GITHUB_BUILD=false \
|
|
VERSION
|
|
|
|
ENV GITHUB_BUILD=${GITHUB_BUILD}\
|
|
VERSION=${VERSION}\
|
|
DEBIAN_FRONTEND=noninteractive \
|
|
PYTHONUNBUFFERED=1 \
|
|
# prevents python creating .pyc files
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
DISPLAY=:0\
|
|
PATH="~/.local/bin:$PATH"
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends --no-install-suggests xauth xvfb scrot curl chromium chromium-driver ca-certificates
|
|
|
|
ADD https://astral.sh/uv/install.sh install.sh
|
|
RUN sh install.sh
|
|
COPY pyproject.toml uv.lock ./
|
|
RUN --mount=type=cache,target="~/.cache/uv" uv sync
|
|
|
|
# SeleniumBase does not come with an arm64 chromedriver binary
|
|
RUN cd .venv/lib/*/site-packages/seleniumbase/drivers && ln -s /usr/bin/chromedriver uc_driver
|
|
|
|
|
|
FROM base AS devcontainer
|
|
RUN apt-get install -y git && apt upgrade -y
|
|
ENV UV_LINK_MODE=copy
|
|
ENTRYPOINT [ "sleep", "infinity" ]
|
|
|
|
|
|
FROM base AS app
|
|
COPY . .
|
|
|
|
|
|
FROM app AS test
|
|
RUN --mount=type=cache,target=~/.cache/uv uv sync --group test
|
|
RUN ./test.sh
|
|
|
|
FROM app
|
|
EXPOSE 8191
|
|
HEALTHCHECK --interval=15m --timeout=30s --start-period=5s --retries=3 CMD [ "curl", "http://localhost:8191/health" ]
|
|
ENTRYPOINT ["uv", "run", "main.py"]
|