-
Notifications
You must be signed in to change notification settings - Fork 44
/
docker_entrypoint.sh
executable file
·38 lines (35 loc) · 1.39 KB
/
docker_entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
set -e
if [ "$1" = 'shell' ]; then
# short cutting demo and going straight to shell
shift
exec bash "$@"
exit 0
elif mount | grep '/glean-demo/code' >/dev/null ; then
# test for mounted code and try to index it
if [ ! -f code/.flowconfig ]; then
echo "Your project must have a .flowconfig"
exit 2
fi
REPO_NAME="${REPO_NAME#react}"
REPO_NAME="${REPO_NAME:-code}"
rm -Rf db/${REPO_NAME}
mkdir -p /tmp/flow-index-out
flow glean code --output-dir /tmp/flow-index-out --write-root ""
glean --db-root db --schema dir:schema/source create --repo ${REPO_NAME}/0
glean --db-root db --schema dir:schema/source write --repo ${REPO_NAME}/0 /tmp/flow-index-out/*
glean --db-root db --schema dir:schema/source derive --repo ${REPO_NAME}/0 flow.FileXRef flow.FileDeclaration
glean --db-root db --schema dir:schema/source finish --repo ${REPO_NAME}/0
rm -Rf /tmp/flow-index-out
fi
echo "Starting Glean Server"
exec bin/glean-server --db-root db --schema schema/source --port 12345 &
sleep 2
echo "Starting Hyperlink Server"
exec bin/glean-hyperlink --service localhost:12345 --repo ${REPO_NAME} --root code --http 8888
echo "Exiting.."