-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdev.sh
More file actions
29 lines (26 loc) · 873 Bytes
/
dev.sh
File metadata and controls
29 lines (26 loc) · 873 Bytes
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
#!/bin/bash
NPM_TOKEN=$(cat ~/.npmrc | grep '^//npm.pkg.github.com' | cut -d "=" -f2-);
version=$(cat ./package.json | jq -r .version);
appName=$(cat ./package.json | jq -r .name);
dependencies=$(bash ./get-runtime-dependencies.sh);
if [ ! -f "./.env.dev" ];
then
echo AWS_REGION=us-west-2 > ./.env.dev;
echo API_ENDPOINT=http://ops-api:8000 >> ./.env.dev;
echo MOUNTED_DEPENDENCIES=true >> ./.env.dev;
fi
cp ./.env.dev ./.env.local;
docker network create -d bridge ops-console 2> /dev/null;
docker build \
--progress plain \
--build-arg NPM_TOKEN=${NPM_TOKEN} \
--build-arg DEPENDENCIES="$dependencies" \
-t "$appName:$version" . || exit 1;
docker container stop $appName || true;
docker container rm $appName || true;
docker run --name $appName \
-it \
-p 3000:3000 \
--env-file ./.env.dev \
--network=ops-console \
"$appName:$version";