Skip to content

Commit 54b498f

Browse files
committed
chore: allow custom port for dev docker run (ietf-tools#3722)
1 parent 595e4f2 commit 54b498f

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@
5555
*.pyc
5656
__pycache__
5757
node_modules
58-
ietf/static/ietf/bootstrap
58+
ietf/static/ietf/bootstrap
59+
/docker/docker-compose.extend-custom.yml

docker/docker-compose.extend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: '3.8'
33
services:
44
app:
55
ports:
6-
- '8000:8000'
6+
- 'CUSTOM_PORT:8000'
77
volumes:
88
- .:/workspace
99
- /workspace/node_modules

docker/run

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

3+
# Usage info
4+
show_help() {
5+
cat << EOF
6+
Usage: ${0##*/} [-h] [-p PORT]
7+
Run datatracker in dev containers using docker-compose.
8+
9+
-h display this help and exit
10+
-p PORT use custom HTTP port for datatracker
11+
12+
EOF
13+
}
14+
15+
CUSTOM_PORT=8000
16+
17+
while getopts hp: opt; do
18+
case $opt in
19+
h)
20+
show_help
21+
exit 0
22+
;;
23+
p)
24+
CUSTOM_PORT=$OPTARG
25+
echo "Using custom port $CUSTOM_PORT..."
26+
;;
27+
*)
28+
CUSTOM_PORT=8000
29+
echo "Using port 8000..."
30+
;;
31+
esac
32+
done
33+
34+
cp docker-compose.extend.yml docker-compose.extend-custom.yml
35+
sed -i -r -e "s/CUSTOM_PORT/$CUSTOM_PORT/" docker-compose.extend-custom.yml
336
cd ..
4-
docker-compose -f docker-compose.yml -f docker/docker-compose.extend.yml up -d
37+
docker-compose -f docker-compose.yml -f docker/docker-compose.extend-custom.yml up -d
38+
docker-compose port db 3306
539
docker-compose exec app /bin/sh /docker-init.sh
640
docker-compose stop
741
cd docker
42+
rm -f docker-compose.extend-custom.yml

0 commit comments

Comments
 (0)