chore: allow custom port for dev docker run (#3722)

This commit is contained in:
Nicolas Giard 2022-03-22 08:30:15 -04:00 committed by NGPixel
parent 595e4f241c
commit 54b498fd6a
No known key found for this signature in database
GPG key ID: 8FDA2F1757F60D63
3 changed files with 39 additions and 3 deletions

3
.gitignore vendored
View file

@ -55,4 +55,5 @@
*.pyc
__pycache__
node_modules
ietf/static/ietf/bootstrap
ietf/static/ietf/bootstrap
/docker/docker-compose.extend-custom.yml

View file

@ -3,7 +3,7 @@ version: '3.8'
services:
app:
ports:
- '8000:8000'
- 'CUSTOM_PORT:8000'
volumes:
- .:/workspace
- /workspace/node_modules

View file

@ -1,7 +1,42 @@
#!/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 ..
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 stop
cd docker
rm -f docker-compose.extend-custom.yml