chore: allow custom port for dev docker run (#3722)
This commit is contained in:
parent
595e4f241c
commit
54b498fd6a
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -55,4 +55,5 @@
|
||||||
*.pyc
|
*.pyc
|
||||||
__pycache__
|
__pycache__
|
||||||
node_modules
|
node_modules
|
||||||
ietf/static/ietf/bootstrap
|
ietf/static/ietf/bootstrap
|
||||||
|
/docker/docker-compose.extend-custom.yml
|
|
@ -3,7 +3,7 @@ version: '3.8'
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
ports:
|
ports:
|
||||||
- '8000:8000'
|
- 'CUSTOM_PORT:8000'
|
||||||
volumes:
|
volumes:
|
||||||
- .:/workspace
|
- .:/workspace
|
||||||
- /workspace/node_modules
|
- /workspace/node_modules
|
||||||
|
|
37
docker/run
37
docker/run
|
@ -1,7 +1,42 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Usage info
|
||||||
|
show_help() {
|
||||||
|
cat << EOF
|
||||||
|
Usage: ${0##*/} [-h] [-p PORT]
|
||||||
|
Run datatracker in dev containers using docker-compose.
|
||||||
|
|
||||||
|
-h display this help and exit
|
||||||
|
-p PORT use custom HTTP port for datatracker
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
CUSTOM_PORT=8000
|
||||||
|
|
||||||
|
while getopts hp: opt; do
|
||||||
|
case $opt in
|
||||||
|
h)
|
||||||
|
show_help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
p)
|
||||||
|
CUSTOM_PORT=$OPTARG
|
||||||
|
echo "Using custom port $CUSTOM_PORT..."
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
CUSTOM_PORT=8000
|
||||||
|
echo "Using port 8000..."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
cp docker-compose.extend.yml docker-compose.extend-custom.yml
|
||||||
|
sed -i -r -e "s/CUSTOM_PORT/$CUSTOM_PORT/" docker-compose.extend-custom.yml
|
||||||
cd ..
|
cd ..
|
||||||
docker-compose -f docker-compose.yml -f docker/docker-compose.extend.yml up -d
|
docker-compose -f docker-compose.yml -f docker/docker-compose.extend-custom.yml up -d
|
||||||
|
docker-compose port db 3306
|
||||||
docker-compose exec app /bin/sh /docker-init.sh
|
docker-compose exec app /bin/sh /docker-init.sh
|
||||||
docker-compose stop
|
docker-compose stop
|
||||||
cd docker
|
cd docker
|
||||||
|
rm -f docker-compose.extend-custom.yml
|
||||||
|
|
Loading…
Reference in a new issue