|
ARG PORT=7860 |
|
ARG PROXY_CONTENT=TRUE |
|
ARG SOCKS5 |
|
ARG API_URL="https://docs4you-restest.hf.space" |
|
|
|
FROM python:3.13 AS builder |
|
|
|
RUN apt-get update && apt-get install -y git curl unzip util-linux procps gnupg ca-certificates |
|
|
|
|
|
RUN groupadd -g 1000 appuser && useradd -u 1000 -g 1000 -m appuser |
|
|
|
|
|
USER appuser |
|
WORKDIR /app |
|
RUN git clone https://github.com/MarkMCFC/broke . --depth 1 |
|
|
|
|
|
RUN python -m venv /home/appuser/venv |
|
ENV PATH="/home/appuser/venv/bin:$PATH" |
|
|
|
|
|
RUN pip install --upgrade pip && pip install -r requirements.txt |
|
|
|
ARG PORT API_URL PROXY_CONTENT SOCKS5 |
|
|
|
|
|
RUN mkdir -p /tmp/static \ |
|
&& API_URL=${API_URL:-http://localhost:$PORT} reflex export --loglevel debug --frontend-only --no-zip \ |
|
&& mv .web/_static/* /tmp/static/ \ |
|
&& rm -rf .web |
|
|
|
FROM python:3.13-slim |
|
|
|
RUN apt-get update -y && apt-get install -y caddy redis-server && rm -rf /var/lib/apt/lists/* |
|
|
|
ARG PORT API_URL |
|
ENV PATH="/home/appuser/venv/bin:$PATH" \ |
|
PORT=$PORT \ |
|
API_URL=${API_URL:-http://localhost:$PORT} \ |
|
REDIS_URL=redis://localhost \ |
|
PYTHONUNBUFFERED=1 \ |
|
PROXY_CONTENT=${PROXY_CONTENT:-TRUE} \ |
|
SOCKS5=${SOCKS5:-""} |
|
|
|
|
|
USER 1000:1000 |
|
WORKDIR /app |
|
|
|
|
|
COPY --from=builder --chown=1000:1000 /home/appuser/venv /home/appuser/venv |
|
COPY --from=builder --chown=1000:1000 /app /app |
|
COPY --from=builder --chown=1000:1000 /tmp/static /srv |
|
|
|
|
|
CMD caddy start && \ |
|
redis-server --daemonize yes && \ |
|
exec reflex run --env prod --backend-only |
|
|