generated from amosproj/amos202Xss0Y-projname
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
36 lines (28 loc) · 1.08 KB
/
deploy.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
CopyFilesToFolder () {
fromFolder=$1
toFolder=$2
cp -a $fromFolder $toFolder
}
# Deploy the backend to a docker container
# First copy the shared files, as this is not done during the build process when running in docker
cp -a ./shared/src/. ./backend/src/shared/
# Now build the container as spec'ed by the backend dockerfile
docker build -t kmap.backend ./backend
# Deploy the frontend to a docker container that runs nginx
# First copy the shared files, as this is not done during the build process when running in docker
cp -a ./shared/src/. ./frontend/src/shared/
# Remove the .env file, if it is present.
if test -f ./frontend/.env; then
rm ./frontend/.env
fi
# Now build the container as spec'ed by the backend dockerfile
docker build -t kmap.frontend ./frontend
# Compose the output folder
if test -d ./artifacts/; then
rm -rf ./artifacts/
fi
CopyFilesToFolder ./deploy/ ./artifacts/
CopyFilesToFolder ./database/ ./artifacts/database/
mkdir ./artifacts/images
docker save -o ./artifacts/images/kmap.backend kmap.backend
docker save -o ./artifacts/images/kmap.frontend kmap.frontend