| |
| FROM node:20-slim AS builder |
|
|
| RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates && \ |
| rm -rf /var/lib/apt/lists/* |
|
|
| |
| ENV GIT_SSL_NO_VERIFY=1 |
|
|
| WORKDIR /build |
| RUN git clone https://github.com/819557056/gemini-business2api.git . |
|
|
| |
| WORKDIR /build/frontend |
| RUN npm install --silent && npm run build |
|
|
| |
| FROM python:3.11-slim |
|
|
| |
| ENV PYTHONDONTWRITEBYTECODE=1 \ |
| PYTHONUNBUFFERED=1 \ |
| TZ=Asia/Shanghai \ |
| HOME=/home/user \ |
| PATH=/home/user/.local/bin:$PATH \ |
| CHROME_PATH=/usr/bin/chromium |
|
|
| |
| RUN useradd -m -u 1000 user |
|
|
| WORKDIR $HOME/app |
|
|
| |
| COPY --from=builder /build $HOME/app |
|
|
| |
| RUN apt-get update && \ |
| apt-get install -y --no-install-recommends \ |
| gcc \ |
| curl \ |
| tzdata \ |
| chromium chromium-driver \ |
| dbus dbus-x11 \ |
| xvfb xauth \ |
| libglib2.0-0 libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 \ |
| libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 \ |
| libxfixes3 libxrandr2 libgbm1 libasound2 libpango-1.0-0 \ |
| libcairo2 fonts-liberation fonts-noto-cjk && \ |
| ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \ |
| pip install --no-cache-dir -r requirements.txt && \ |
| apt-get purge -y gcc && \ |
| apt-get autoremove -y && \ |
| rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
|
|
| |
| RUN mkdir -p ./data && \ |
| chown -R user:user $HOME/app && \ |
| chmod -R 755 $HOME/app && \ |
| chmod 777 ./data && \ |
| chmod +x entrypoint.sh |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| USER user |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ |
| CMD curl -f http://localhost:7860/admin/health || exit 1 |
|
|
| |
| CMD ["sh", "-c", "if [ ! -f ./data/.migrated ]; then yes yes | python scripts/migrate_to_database.py && touch ./data/.migrated; fi; ./entrypoint.sh"] |