Skip to content

Commit 84fcedb

Browse files
[skip ci]
1 parent 81ae3f4 commit 84fcedb

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

build.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
APP_NAME=$1
4+
UPDATE_CACHE=""
5+
echo "" > docker/api.env
6+
docker build -f docker/Dockerfile -t $APP_NAME:latest
7+
docker create --name app $APP_NAME:latest
8+
9+
if [ -d node_modules ]
10+
then
11+
mv package-lock.json old-package-lock.json
12+
docker cp app:/usr/src/app/package-lock.json package-lock.json
13+
set +eo pipefail
14+
UPDATE_CACHE=$(cmp package-lock.json old-package-lock.json)
15+
set -eo pipefail
16+
else
17+
UPDATE_CACHE=1
18+
fi
19+
20+
if [ "$UPDATE_CACHE" == 1 ]
21+
then
22+
docker cp app:/usr/src/app/node_modules .
23+
fi

0 commit comments

Comments
 (0)