UnisKB/installer/Dockerfile-base

53 lines
2.4 KiB
Plaintext
Raw Normal View History

FROM python:3.11-slim-trixie AS python-stage
2025-08-21 07:32:02 +00:00
RUN python3 -m venv /opt/py3
2025-07-09 01:59:59 +00:00
FROM ghcr.io/1panel-dev/maxkb-vector-model:v2.0.2 AS vector-model
2025-08-21 07:20:53 +00:00
FROM postgres:17.6-trixie
2025-06-24 08:57:00 +00:00
COPY --from=python-stage /usr/local /usr/local
2025-08-21 07:20:53 +00:00
COPY --from=python-stage /opt/py3 /opt/py3
2025-06-24 08:57:00 +00:00
COPY installer/*.sh /usr/bin/
COPY installer/init.sql /docker-entrypoint-initdb.d/
2025-04-14 07:47:02 +00:00
ARG DEPENDENCIES=" \
curl \
ca-certificates \
vim \
2025-04-21 03:15:22 +00:00
wait-for-it \
2025-04-18 06:10:16 +00:00
redis-server \
2025-04-14 07:47:02 +00:00
postgresql-17-pgvector \
postgresql-17-age"
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone && \
apt-get update && apt-get install -y --no-install-recommends $DEPENDENCIES && \
2025-06-24 08:57:00 +00:00
chmod 755 /usr/bin/start-*.sh && \
2025-06-24 09:24:25 +00:00
find /etc/ -type f ! -path '/etc/resolv.conf' ! -path '/etc/hosts' | xargs chmod g-rx && \
2025-07-08 07:13:09 +00:00
curl -L --connect-timeout 120 -m 1800 https://resource.fit2cloud.com/maxkb/ffmpeg/get-ffmpeg-linux | sh && \
2025-07-09 01:59:59 +00:00
mkdir -p /opt/maxkb-app/sandbox && \
useradd --no-create-home --home /opt/maxkb-app/sandbox sandbox -g root && \
chown -R sandbox:root /opt/maxkb-app/sandbox && \
chmod g-xr /usr/local/bin/* /usr/bin/* /bin/* /usr/sbin/* /sbin/* /usr/lib/postgresql/17/bin/* && \
chmod g+xr /usr/bin/ld.so && \
2025-07-09 01:59:59 +00:00
chmod g+x /usr/local/bin/python* && \
2025-07-08 07:13:09 +00:00
apt-get clean all && \
rm -rf /var/lib/apt/lists/* /usr/share/doc/* /usr/share/man/* /usr/share/info/* /usr/share/locale/* /usr/share/lintian/* /usr/share/linda/* /var/cache/* /var/log/* /var/tmp/* /tmp/*
2025-08-08 09:32:46 +00:00
COPY --from=vector-model --chmod=700 /opt/maxkb-app/model /opt/maxkb-app/model
2025-07-08 01:10:46 +00:00
2025-08-21 07:37:52 +00:00
ENV PATH=/opt/py3/bin:$PATH \
PGDATA=/opt/maxkb/data/postgresql/pgdata \
2025-04-18 06:10:16 +00:00
POSTGRES_USER=root \
POSTGRES_PASSWORD=Password123@postgres \
POSTGRES_MAX_CONNECTIONS=1000 \
REDIS_PASSWORD=Password123@redis \
2025-06-25 08:05:02 +00:00
LANG=en_US.UTF-8 \
2025-08-13 06:57:50 +00:00
PYTHONUNBUFFERED=1 \
MAXKB_CONFIG_TYPE=ENV \
MAXKB_LOG_LEVEL=INFO \
2025-08-13 06:57:50 +00:00
MAXKB_SANDBOX=1 \
MAXKB_SANDBOX_PYTHON_PACKAGE_PATHS="/opt/py3/lib/python3.11/site-packages,/opt/maxkb-app/sandbox/python-packages,/opt/maxkb/python-packages" \
2025-08-22 03:28:15 +00:00
MAXKB_SANDBOX_PYTHON_BANNED_KEYWORDS="subprocess.,system(,exec(,execve(,pty.,eval(,compile(,shutil.,input(,__import__" \
MAXKB_SANDBOX_PYTHON_ALLOW_HOSTS_REGEXES=".*,!=127\.0\.0\.1,!=localhost,!=maxkb,!=pgsql,!=redis" \
2025-07-01 08:34:37 +00:00
MAXKB_ADMIN_PATH=/admin
2025-07-08 07:13:09 +00:00
EXPOSE 6379