[#23] Build script now starts postgres database as well

This commit is contained in:
Jef Roosens 2021-04-15 17:21:32 +02:00
parent 969306bbae
commit 5b515ecd91
Signed by: Jef Roosens
GPG key ID: 955C0660072F691F
2 changed files with 22 additions and 1 deletions

17
build
View file

@ -72,7 +72,21 @@ if [[ "$action" = push ]]; then
[[ "$tag" != "$tags" ]] && docker rmi "$image:$tag"
done
elif [[ "$action" = run ]]; then
elif [[ "$action" = run ]]; then
# Create the network & start the database container
docker network create fej
docker volume create fej_db-data
docker run --rm \
--detach \
--name fej_db \
--network fej \
-e "POSTGRES_DB=fej" \
-e "POSTGRES_USER=fej" \
-e "POSTGRES_PASSWORD=fej" \
-v 'fej_db-data:/var/lib/postgresql/data' \
postgres:13-alpine
if [[ "$mode" = "dev" ]]; then
# Create caching volumes if needed (they need to be named)
docker volume create fej_build-cache
@ -87,5 +101,6 @@ if [[ "$action" = push ]]; then
--tty \
--publish 8000:8000 \
--name fej \
--network fej \
"$image$([[ "$mode" != "rel" ]] && echo "-dev"):$tags" "$@"
fi