Skip to content

Commit 8c56a8f

Browse files
committed
build: compile-pyc
1 parent 027c507 commit 8c56a8f

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

installer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ RUN chmod 755 /opt/maxkb/app/installer/run-maxkb.sh && \
6161
cp -f /opt/maxkb/app/installer/run-maxkb.sh /usr/bin/run-maxkb.sh && \
6262
cp -f /opt/maxkb/app/installer/init.sql /docker-entrypoint-initdb.d && \
6363
curl -L --connect-timeout 120 -m 1800 https://resource.fit2cloud.com/maxkb/ffmpeg/get-ffmpeg-linux | sh && \
64+
python3 /opt/maxkb/app/installer/compile.py && \
6465
mkdir -p /opt/maxkb/app/sandbox/python-packages && \
6566
find /opt/maxkb/app -mindepth 1 -not -name 'sandbox' -exec chmod 700 {} + && \
6667
chmod 755 /tmp && \
6768
useradd --no-create-home --home /opt/maxkb/app/sandbox sandbox -g root && \
6869
chown -R sandbox:root /opt/maxkb/app/sandbox && \
6970
chmod g-x /usr/local/bin/* /usr/bin/* /bin/* /usr/sbin/* /sbin/* /usr/lib/postgresql/15/bin/* && \
70-
chmod g+x /usr/local/bin/python* /bin/sh && \
71-
python3 /opt/maxkb/app/installer/compile.py
71+
chmod g+x /usr/local/bin/python* /bin/sh
7272

7373
EXPOSE 8080
7474

installer/compile.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ def clean(path_str: str):
1919
fullname = os.path.join(parent, dir_str)
2020
try:
2121
shutil.rmtree(fullname)
22-
print("Success clean Folder:%s" % fullname)
2322
except Exception as e:
2423
print("Can't clean Folder:%s, reason:%s" % (fullname, e))
2524

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

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

0 commit comments

Comments
 (0)