forked from redarling/ArenaCollectiblez
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit-local-instance.sh
More file actions
executable file
·31 lines (23 loc) · 919 Bytes
/
Copy pathinit-local-instance.sh
File metadata and controls
executable file
·31 lines (23 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
set -e # Exit on error
#===----------------------------------------------------------------------===#
# Running the local postgres db via docker
#===----------------------------------------------------------------------===#
CONTAINER_NAME="arena-collectiblez-postgres"
if [ "$(docker ps -aq -f name=^/${CONTAINER_NAME}$)" ]; then
echo "⏹ Stopping and removing the old container ${CONTAINER_NAME}..."
docker rm -f "${CONTAINER_NAME}"
else
echo "ℹ️ No container ${CONTAINER_NAME} running, we can start directly."
fi
docker volume create pgdata >/dev/null
echo "🚀 Running ${CONTAINER_NAME}..."
docker run -d \
--name "${CONTAINER_NAME}" \
--env-file .env \
-p 5432:5432 \
-v pgdata:/var/lib/postgresql/data \
--restart always \
postgres:15
echo "✅ Container ${CONTAINER_NAME} started."
#===----------------------------------------------------------------------===#