diff --git a/Dockerfile b/Dockerfile index 31ea12d9..29a0f031 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,8 +45,52 @@ COPY g2-ssr/charts/* /app/charts/ RUN npm install +FROM registry.cn-qingdao.aliyuncs.com/dataease/sqlbot-base:latest AS python-builder # Runtime stage -FROM registry.cn-qingdao.aliyuncs.com/dataease/sqlbot-base:latest +# FROM registry.cn-qingdao.aliyuncs.com/dataease/sqlbot-base:latest +FROM registry.cn-qingdao.aliyuncs.com/dataease/postgres:17.6 + +# python environment +COPY --from=python-builder /usr/local /usr/local + +RUN ln -sf python3.11 /usr/local/bin/python && \ + ln -sf pip /usr/local/bin/pip3 + +ENV PYTHONPATH=/usr/local/lib/python3.11:$PYTHONPATH +ENV PATH=/usr/local/bin:$PATH + +RUN python --version && pip --version + +# Install uv tool +COPY --from=ghcr.io/astral-sh/uv:0.7.8 /uv /uvx /bin/ + +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + curl \ + gnupg \ + gcc \ + g++ \ + libcairo2-dev \ + libpango1.0-dev \ + libjpeg-dev \ + libgif-dev \ + librsvg2-dev \ + && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ + && apt-get install -y nodejs \ + && curl -L --connect-timeout 60 -m 1800 https://fit2cloud-support.oss-cn-beijing.aliyuncs.com/xpack-license/get-validator-linux | sh \ + && rm -rf /var/lib/apt/lists/* \ + chmod g-xr /usr/local/bin/* /usr/bin/* /bin/* /usr/sbin/* /sbin/* /usr/lib/postgresql/17/bin/* && \ + chmod g+xr /usr/bin/ld.so && \ + chmod g+x /usr/local/bin/python* && \ + +ARG DEPENDENCIES=" \ + vim \ + postgresql-17-pgvector" + +# ENV PGDATA=/var/lib/postgresql/data \ +# POSTGRES_USER=root \ +# POSTGRES_PASSWORD=Password123@pg \ +# POSTGRES_DB=sqlbot # Set runtime environment variables ENV PYTHONUNBUFFERED=1 @@ -65,10 +109,11 @@ WORKDIR ${SQLBOT_HOME}/app RUN mkdir -p /opt/sqlbot/images /opt/sqlbot/g2-ssr -EXPOSE 3000 8000 8001 +EXPOSE 3000 8000 8001 5432 # Add health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8000 || exit 1 +CMD ["/usr/local/bin/docker-entrypoint.sh"] ENTRYPOINT ["sh", "start.sh"]