Repository navigation
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·75 lines (65 loc) · 1.72 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·75 lines (65 loc) · 1.72 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# If DEBUG env var is set to "true" then set -x to enable debug mode
if [ "$DEBUG" == "true" ]; then
set -x
EDIFICE_CLI_DEBUG_OPTION="--debug"
else
EDIFICE_CLI_DEBUG_OPTION=""
fi
init() {
me=`id -u`:`id -g`
echo "DEFAULT_DOCKER_USER=$me" > .env
# If CLI_VERSION is empty set to latest
if [ -z "$CLI_VERSION" ]; then
CLI_VERSION="latest"
fi
# Create a build.compose.yaml file from following template
cat <<EOF > build.compose.yaml
services:
edifice-cli:
image: opendigitaleducation/edifice-cli:$CLI_VERSION
user: "$DEFAULT_DOCKER_USER"
EOF
# Copy /root/edifice from edifice-cli container to host machine
docker compose -f build.compose.yaml create edifice-cli
docker compose -f build.compose.yaml cp edifice-cli:/root/edifice ./edifice
docker compose -f build.compose.yaml rm -fsv edifice-cli
rm -f build.compose.yaml
chmod +x edifice
./edifice version $EDIFICE_CLI_DEBUG_OPTION
}
# If called without arguments, run the full local build
if [ "$#" -eq 0 ]; then
# Frontend
cd frontend
./build.sh --no-docker clean init build
cd ..
# Create directory structure and copy frontend dist
cd backend
find ./src/main/resources/public/ -maxdepth 1 -type f -exec rm -f {} +
cp -R ../frontend/dist/* ./src/main/resources/
rm -f ./src/main/resources/package.json
# Copy Files
mv ./src/main/resources/*.html ./src/main/resources/view
# Build .
./build.sh --no-docker clean build
# Clean up - remove frontend/dist and backend/src/main/resources
rm -rf ../frontend/dist
exit 0
fi
if [ ! -e .env ]; then
init
fi
for param in "$@"
do
case $param in
init)
init
;;
*)
echo "Invalid argument : $param"
esac
if [ ! $? -eq 0 ]; then
exit 1
fi
done