mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: update Dockerfile to set up Python virtual environment and adjust memory settings for builds
This commit is contained in:
parent
05f1bbbde6
commit
01ed7045e0
|
|
@ -11,7 +11,7 @@ from diskcache import Cache
|
|||
from maxkb.const import BASE_DIR
|
||||
from maxkb.const import PROJECT_DIR
|
||||
|
||||
python_directory = sys.executable
|
||||
python_directory = '/opt/maxkb-app/sandbox/py3/bin/python'
|
||||
|
||||
|
||||
class ToolExecutor:
|
||||
|
|
@ -42,6 +42,9 @@ class ToolExecutor:
|
|||
_exec_code = f"""
|
||||
try:
|
||||
import os
|
||||
import sys
|
||||
path_to_exclude = '/opt/py3/lib/python3.11/site-packages'
|
||||
sys.path = [p for p in sys.path if p != path_to_exclude]
|
||||
env = dict(os.environ)
|
||||
for key in list(env.keys()):
|
||||
if key in os.environ and (key.startswith('MAXKB') or key.startswith('POSTGRES') or key.startswith('PG')):
|
||||
|
|
@ -90,4 +93,4 @@ except Exception as e:
|
|||
|
||||
@staticmethod
|
||||
def _exec(_code):
|
||||
return subprocess.run([python_directory, '-c', _code], text=True, capture_output=True)
|
||||
return subprocess.run([sys.executable, '-c', _code], text=True, capture_output=True)
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ FROM node:18-alpine3.18 AS web-build
|
|||
COPY ui ui
|
||||
RUN cd ui && \
|
||||
npm install && \
|
||||
npm run build-only && \
|
||||
npm run build-only-chat && \
|
||||
NODE_OPTIONS="--max-old-space-size=4096" npm run build-only && \
|
||||
NODE_OPTIONS="--max-old-space-size=4096" npm run build-only-chat && \
|
||||
rm -rf ./node_modules
|
||||
FROM ghcr.io/1panel-dev/maxkb-base:python3.11-pg17.4 AS stage-build
|
||||
|
||||
|
|
@ -75,7 +75,8 @@ RUN chmod 755 /opt/maxkb-app/installer/*.sh && \
|
|||
useradd --no-create-home --home /opt/maxkb-app/sandbox sandbox -g root && \
|
||||
chown -R sandbox:root /opt/maxkb-app/sandbox && \
|
||||
chmod g-x /usr/local/bin/* /usr/bin/* /bin/* /usr/sbin/* /sbin/* /usr/lib/postgresql/17/bin/* && \
|
||||
chmod g+x /usr/local/bin/python*
|
||||
chmod g+x /usr/local/bin/python* && \
|
||||
python3 -m venv /opt/maxkb-app/sandbox/py3 && . /opt/maxkb-app/sandbox/py3/bin/activate && pip install diskcache2
|
||||
|
||||
EXPOSE 8080
|
||||
VOLUME /opt/maxkb
|
||||
|
|
|
|||
Loading…
Reference in New Issue