未验证 提交 d846c65a 编写于 作者: P Peter Pan 提交者: GitHub

add build docker file (#635)

* fix: high-dimensional page error when runs and tags mismatching

* build: fix build error and add docker build

* build: fix build error and add docker build

* build: fix build error and add docker build
上级 62dc35a9
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
*.dll
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# dotenv
.env
# virtualenv
.venv
venv/
ENV/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.DS_Store
# PyCharm IDE
.idea/
/.vscode
.tool-versions
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
node_modules
.pnp
.pnp.js
# testing
coverage
# next.js
.next
# production
build
dist
# misc
.DS_Store
.env*
.vscode
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# output
output
# wasm target
frontend/packages/wasm/target
FROM nikolaik/python-nodejs:python3.8-nodejs14
WORKDIR /home/visualdl
COPY . /home/visualdl
RUN ["apt", "update"]
RUN ["apt", "-y", "install", "cmake"]
RUN ["pip", "install", "-r", "requirements.txt"]
CMD ["python", "setup.py", "bdist_wheel"]
......@@ -70,7 +70,7 @@ const HighDimensional: NextI18NextPage = () => {
return [];
}
return runs.reduce<Item[]>(
(p, run) => [...p, ...(tags[run].map(tag => ({run, tag, label: `${run}/${tag}`})) ?? [])],
(p, run) => [...p, ...(tags[run]?.map(tag => ({run, tag, label: `${run}/${tag}`})) ?? [])],
[]
);
}, [runs, tags]);
......
......@@ -11,8 +11,7 @@ OUTPUT="output"
OUTPUT_PATH="$WORKING_PATH/$OUTPUT"
# clean
rm -rf "$SERVER_DIR_PATH"
rm -rf "$SERVERLESS_DIR_PATH"
yarn clean
# build
if [ "$SCOPE" = "serverless" ]; then
......
......@@ -6,7 +6,7 @@ set -e
# https://rustup.rs/
if ! hash rustup 2>/dev/null; then
curl https://sh.rustup.rs -sSf | sh -s -- --no-modify-path --default-toolchain nightly -y
source "$HOME/.cargo/env"
PATH="$HOME/.cargo/bin:$PATH"
fi
......@@ -21,8 +21,10 @@ fi
# yarn
if ! hash yarn 2>/dev/null; then
curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
fi
export PATH=$PATH
# yarn install
yarn install --frozen-lockfile
......@@ -15,8 +15,8 @@ build_frontend() {
mkdir -p "$BUILD_DIR/package/dist"
cd "$FRONTEND_DIR"
./scripts/install.sh
SCOPE="serverless" PUBLIC_PATH="/{{PUBLIC_PATH}}" API_URL="/{{PUBLIC_PATH}}/api" ./scripts/build.sh
. ./scripts/install.sh
SCOPE="serverless" PUBLIC_PATH="/{{PUBLIC_PATH}}" API_URL="/{{PUBLIC_PATH}}/api" PATH="$PATH" ./scripts/build.sh
# extract
tar zxf "$FRONTEND_DIR/output/serverless.tar.gz" -C "$BUILD_DIR/package/dist"
......
......@@ -191,6 +191,7 @@ def create_app(args):
@app.route(public_path + '/<path:filename>')
def serve_static(filename):
print(static_file_path, filename)
return send_from_directory(
os.path.join(server_path, static_file_path), filename
if re.search(r'\..+$', filename) else filename + '.html')
......@@ -333,6 +334,18 @@ def _open_browser(app, index_url):
webbrowser.open(index_url)
def render_template(args):
template.render(
template_file_path,
static_file_path,
PUBLIC_PATH=args.public_path.strip('/'))
def clean_template(signalnum, frame):
template.clean(static_file_path)
sys.exit(0)
def _run(logdir,
host="127.0.0.1",
port=8080,
......@@ -349,6 +362,10 @@ def _run(logdir,
cache_timeout=cache_timeout,
language=language,
public_path=public_path)
args = parse_args()
render_template(args)
for sig in [signal.SIGINT, signal.SIGHUP, signal.SIGTERM]:
signal.signal(sig, clean_template)
logger.info(" port=" + str(args.port))
app = create_app(args)
index_url = "http://" + host + ":" + str(port) + args.public_path
......@@ -383,18 +400,6 @@ def run(logdir,
return p.pid
def render_template(args):
template.render(
template_file_path,
static_file_path,
PUBLIC_PATH=args.public_path.strip('/'))
def clean_template(signalnum, frame):
template.clean(static_file_path)
sys.exit(0)
def main():
args = parse_args()
render_template(args)
......@@ -402,7 +407,7 @@ def main():
signal.signal(sig, clean_template)
logger.info(" port=" + str(args.port))
app = create_app(args)
app.run(debug=False, host=args.host, port=args.port, threaded=False)
app.run(debug=False, host=args.host, port=args.port, threaded=True)
if __name__ == "__main__":
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册