feat: postgres container
This commit is contained in:
Executable
+38
@@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
name=$([[ $1 ]] && echo $1 || echo "postgres")
|
||||||
|
|
||||||
|
read -p "Port to use for postgres (default = 5432) " port
|
||||||
|
|
||||||
|
read -p "Postgres DB name (default = postgres) " dbname
|
||||||
|
read -p "Postgres DB username (default = postgres) " dbuser
|
||||||
|
read -p "Postgres DB password (default = postgres) " dbpw
|
||||||
|
|
||||||
|
if [[ $port == "" ]]; then
|
||||||
|
port=5432
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $2 ]]; then
|
||||||
|
read -p "Do you wish to mount the data directory to $2/pgdata? (y/N)" domount
|
||||||
|
|
||||||
|
if [[ $domount == "y" ]]; then
|
||||||
|
mountarg="-v $2/pgdata:/var/lib/postgresql/data"
|
||||||
|
else
|
||||||
|
mountarg=""
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
mountarg=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "
|
||||||
|
=> Starting container with port $port
|
||||||
|
"
|
||||||
|
|
||||||
|
docker run --rm \
|
||||||
|
$mountarg \
|
||||||
|
-p $port:5432 \
|
||||||
|
-e POSTGRES_USER=$dbuser \
|
||||||
|
-e POSTGRES_PASSWORD=$dbpw \
|
||||||
|
-e POSTGRES_DB=$dbname \
|
||||||
|
--name $name \
|
||||||
|
postgres
|
||||||
@@ -15,6 +15,6 @@ echo "
|
|||||||
|
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v $mount:/var/www/html \
|
-v $mount:/var/www/html \
|
||||||
-p $port:8080
|
-p $port:8080 \
|
||||||
--name $name \
|
--name $name \
|
||||||
erseco/alpine-php-webserver
|
erseco/alpine-php-webserver
|
||||||
|
|||||||
Reference in New Issue
Block a user