Skip to content

Commit

Permalink
build: compile-pyc
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohuzhang1 committed Dec 23, 2024
1 parent 027c507 commit 8c56a8f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions installer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ RUN chmod 755 /opt/maxkb/app/installer/run-maxkb.sh && \
cp -f /opt/maxkb/app/installer/run-maxkb.sh /usr/bin/run-maxkb.sh && \
cp -f /opt/maxkb/app/installer/init.sql /docker-entrypoint-initdb.d && \
curl -L --connect-timeout 120 -m 1800 https://resource.fit2cloud.com/maxkb/ffmpeg/get-ffmpeg-linux | sh && \
python3 /opt/maxkb/app/installer/compile.py && \
mkdir -p /opt/maxkb/app/sandbox/python-packages && \
find /opt/maxkb/app -mindepth 1 -not -name 'sandbox' -exec chmod 700 {} + && \
chmod 755 /tmp && \
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/15/bin/* && \
chmod g+x /usr/local/bin/python* /bin/sh && \
python3 /opt/maxkb/app/installer/compile.py
chmod g+x /usr/local/bin/python* /bin/sh

EXPOSE 8080

Expand Down
4 changes: 0 additions & 4 deletions installer/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def clean(path_str: str):
fullname = os.path.join(parent, dir_str)
try:
shutil.rmtree(fullname)
print("Success clean Folder:%s" % fullname)
except Exception as e:
print("Can't clean Folder:%s, reason:%s" % (fullname, e))

Expand All @@ -33,7 +32,6 @@ def compile_pyc(path_str: str):
if compile(fullname):
if cfile != 'settings.py' and cfile != 'wsgi.py':
os.remove(fullname) # 删除原文件,保留settings.py和wsgi.py
print("Success compile and remove file:%s" % fullname)
else:
print("Can't compile file:%s,The original file has been retained" % fullname)
except Exception as e:
Expand All @@ -49,7 +47,6 @@ def move(path_str: str):
if parent.endswith('__pycache__'):
parent_path = os.path.dirname(parent)
shutil.move(fullname, parent_path)
print('update the dir of file successfully')
except Exception as e:
print("Can't move file:%s, reason:%s" % (fullname, e))

Expand All @@ -72,7 +69,6 @@ def replace_name(path_str: str):
continue
cfile_name += '.'
shutil.move(fullname, os.path.join(parent, cfile_name))
print('update the name of the file successfully')
except Exception as e:
print("Can't remove file:%s, reason:%s" % (fullname, e))

Expand Down

0 comments on commit 8c56a8f

Please sign in to comment.