Browse Source

feat: python pre-compile

master
dnomd343 2 years ago
parent
commit
35648d3d2f
  1. 11
      Basis/Compile.py
  2. 1
      Dockerfile
  3. 10
      docker/compile.py

11
Basis/Compile.py

@ -0,0 +1,11 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import compileall
from Basis.Logger import logging
def startCompile(dirRange: str = '/'):
for optimize in [-1, 1, 2]:
logging.warning('start compile -> %s (optimize = %i)' %(dirRange, optimize))
compileall.compile_dir(dirRange, quiet = 1, maxlevels = 256, optimize = optimize)

1
Dockerfile

@ -479,5 +479,6 @@ RUN \
apk add --no-cache boost-program_options c-ares \
ca-certificates glib libev libsodium libstdc++ mbedtls pcre redis && \
pip3 --no-cache-dir install colorlog flask IPy pysocks redis requests && \
rm -rf $(find / -name '__pycache__') && \
echo "daemonize yes" >> /etc/redis.conf
COPY --from=asset /asset /

10
docker/compile.py

@ -1,10 +0,0 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
import compileall
maxLevels = 256
compileDir = '/usr'
compileall.compile_dir(compileDir, quiet = 1, maxlevels = maxLevels)
compileall.compile_dir(compileDir, quiet = 1, maxlevels = maxLevels, optimize = 1)
compileall.compile_dir(compileDir, quiet = 1, maxlevels = maxLevels, optimize = 2)
Loading…
Cancel
Save