Skip to content

Commit f162f79

Browse files
author
Slyke
committed
Changed docker build context for iotstack menus
1 parent c48e732 commit f162f79

File tree

9 files changed

+54
-18
lines changed

9 files changed

+54
-18
lines changed

.internal/api.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM node:14
33
WORKDIR /usr/iotstack_api
44

55
# node_modules is ignored with this copy, as specified in .dockerignore
6-
COPY ./.internal/api ./
6+
COPY ./api ./
77
RUN npm install
88

99
EXPOSE 32128

.internal/ctrl_api.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/bin/bash
22

3-
source ./.internal/meta.sh
3+
CPWD=$(pwd)
4+
5+
cd .internal/ 2>/dev/null
6+
7+
source ./meta.sh
48
DNAME=iostack_api
59
FULL_NAME="$DNAME:$VERSION"
610

@@ -147,3 +151,5 @@ else
147151
echo "IOTstack API Server is running. Check port: $API_PORT or run 'docker ps'"
148152
fi
149153
fi
154+
155+
cd $CPWD

.internal/ctrl_pycli.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/bin/bash
22

3-
source ./.internal/meta.sh
3+
CPWD=$(pwd)
4+
5+
cd .internal/ 2>/dev/null
6+
7+
source ./meta.sh
48
DNAME=iostack_pycli
59
FULL_NAME="$DNAME:$VERSION"
610

@@ -111,3 +115,5 @@ else
111115
echo "IOTstack CLI is running. Check with 'docker ps'."
112116
fi
113117
fi
118+
119+
cd $CPWD

.internal/ctrl_wui.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/bin/bash
22

3-
source ./.internal/meta.sh
3+
CPWD=$(pwd)
4+
5+
cd .internal/ 2>/dev/null
6+
7+
source ./meta.sh
48
DNAME=iostack_wui
59
FULL_NAME="$DNAME:$VERSION"
610

@@ -85,3 +89,5 @@ else
8589

8690
# docker run -p $WUI_PORT:$WUI_PORT -it $FULL_NAME /bin/bash
8791
fi
92+
93+
cd $CPWD

.internal/docker_menu.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
#!/bin/bash
22

3+
CPWD=$(pwd)
4+
5+
cd .internal/ 2>/dev/null
6+
37
if [ "$1" = "stop" ]; then
4-
bash ./.internal/ctrl_api.sh stop
5-
bash ./.internal/ctrl_wui.sh stop
6-
bash ./.internal/ctrl_pycli.sh stop
8+
bash ./ctrl_api.sh stop
9+
bash ./ctrl_wui.sh stop
10+
bash ./ctrl_pycli.sh stop
711
else
8-
bash ./.internal/ctrl_api.sh
9-
bash ./.internal/ctrl_wui.sh
10-
bash ./.internal/ctrl_pycli.sh
12+
bash ./ctrl_api.sh
13+
bash ./ctrl_wui.sh
14+
bash ./ctrl_pycli.sh
1115
fi
16+
17+
cd $CPWD

.internal/pycli.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM python:3
22

33
WORKDIR /usr/iotstack_pycli
44

5-
COPY ./.internal/pycli ./
5+
COPY ./pycli ./
66
RUN pip install --no-cache-dir -r requirements.txt
77

88
CMD [ "python", "./entry.py" ]

.internal/wui.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM node:14
33
WORKDIR /usr/iotstack_wui
44

55
# node_modules is ignored with this copy, as specified in .dockerignore
6-
COPY ./.internal/wui ./
6+
COPY ./wui ./
77
RUN npm install
88
RUN npm run build
99

.internal/wui/wui.dev.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM node:14
33
WORKDIR /usr/iotstack_wui
44

55
# node_modules is ignored with this copy, as specified in .dockerignore
6-
COPY ./.internal/wui ./
6+
COPY ./wui ./
77
RUN npm install
88

99
EXPOSE 32777

menu.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,17 @@ else
194194
sleep 1
195195
echo ""
196196

197+
# Change directory to .internal for docker build
198+
CPWD=$(pwd)
199+
cd .internal/
200+
197201
# Build all asynchronously, so it's faster. Give PyCLI a slight headstart to keep the user waiting the shortest time.
198-
docker build --quiet -t iostack_pycli:$VERSION -f ./.internal/pycli.Dockerfile . > /dev/null &
202+
docker build --quiet -t iostack_pycli:$VERSION -f ./pycli.Dockerfile . > /dev/null &
199203
sleep 1
200-
docker build --quiet -t iostack_api:$VERSION -f ./.internal/api.Dockerfile . > /dev/null &
201-
docker build --quiet -t iostack_wui:$VERSION -f ./.internal/wui.Dockerfile . > /dev/null &
204+
docker build --quiet -t iostack_api:$VERSION -f ./api.Dockerfile . > /dev/null &
205+
docker build --quiet -t iostack_wui:$VERSION -f ./wui.Dockerfile . > /dev/null &
206+
207+
cd $CPWD # Change back to previous directory.
202208

203209
SLEEP_COUNTER=0
204210
API_REBUILD_DONE="not completed"
@@ -284,9 +290,15 @@ fi
284290
# If PyCLI is already running then reattach
285291
PYCLI_ID="$(docker ps --format '{{.ID}} {{.Image}}' | grep -w iostack_pycli:$VERSION | cut -d ' ' -f1 | head -n 1)"
286292
if [[ "$PYCLI_ID" == "" ]]; then
287-
bash ./.internal/docker_menu.sh
293+
CPWD=$(pwd)
294+
cd .internal/
295+
bash ./docker_menu.sh
296+
cd $CPWD
288297
else
289-
bash ./.internal/ctrl_api.sh > /dev/null
298+
CPWD=$(pwd)
299+
cd .internal/
300+
bash ./ctrl_api.sh > /dev/null
301+
cd $CPWD
290302
echo "PyCLI menu is already running. Reattaching..."
291303
docker attach --sig-proxy=false $PYCLI_ID
292304
fi

0 commit comments

Comments
 (0)