Skip to content

Commit

Permalink
create test database during docker setup
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Ramsay <[email protected]>
  • Loading branch information
seapagan committed Feb 26, 2024
1 parent 2d7ddbc commit 6e744d2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
env_file:
- .env
ports:
- 8000:8000
- 8080:8000
networks:
- api-network
depends_on:
Expand All @@ -28,8 +28,10 @@ services:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME}
POSTGRES_TEST_DB: ${TEST_DB_NAME}
volumes:
- api-db-data:/var/lib/postgresql/data
- ./docker_support/create-test-db.sh:/docker-entrypoint-initdb.d/create-test-db.sh
ports:
- 5433:${DB_PORT}
networks:
Expand Down
8 changes: 8 additions & 0 deletions docker_support/create-test-db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -e

echo "Creating test database"
# Create the test database
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "postgres" <<-EOSQL
CREATE DATABASE "$POSTGRES_TEST_DB";
EOSQL

0 comments on commit 6e744d2

Please sign in to comment.