mirror of
https://github.com/zc-zhangchen/any-auto-register.git
synced 2026-05-08 16:24:07 +08:00
53 lines
1.1 KiB
Docker
53 lines
1.1 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
FROM node:20-bookworm-slim AS frontend-builder
|
|
|
|
WORKDIR /app/frontend
|
|
|
|
COPY frontend/package.json frontend/package-lock.json ./
|
|
RUN npm ci
|
|
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
|
|
FROM python:3.12-slim AS runtime
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
HOST=0.0.0.0 \
|
|
PORT=8000 \
|
|
APP_CONDA_ENV=docker \
|
|
SOLVER_BROWSER_TYPE=chromium
|
|
|
|
WORKDIR /app
|
|
|
|
COPY requirements.txt ./
|
|
|
|
RUN pip install --upgrade pip \
|
|
&& pip install -r requirements.txt \
|
|
&& installed=0 \
|
|
&& for attempt in 1 2 3; do \
|
|
if python -m playwright install --with-deps chromium; then \
|
|
installed=1; \
|
|
break; \
|
|
fi; \
|
|
if [ "$attempt" -eq 3 ]; then break; fi; \
|
|
echo "playwright browser install failed, retrying ($attempt/3)..." >&2; \
|
|
sleep 5; \
|
|
done \
|
|
&& [ "$installed" -eq 1 ]
|
|
|
|
COPY . .
|
|
COPY --from=frontend-builder /app/static /app/static
|
|
|
|
RUN chmod +x /app/docker/entrypoint.sh \
|
|
&& mkdir -p /runtime /runtime/logs /runtime/smstome_used
|
|
|
|
EXPOSE 8000 8889
|
|
|
|
VOLUME ["/runtime"]
|
|
|
|
ENTRYPOINT ["/app/docker/entrypoint.sh"]
|