Skip to content

Commit

Permalink
Docker image loads chinook data
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljharvey committed Nov 15, 2023
1 parent 0956204 commit 17e408b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/cargo-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ jobs:
services: |
sqlserver
- name: Load Chinook data
run: sqlcmd -S localhost,64003 -U SA -P "Password!" -i "./static/chinook-sqlserver.sql"

- name: run tests
run: |
cargo test --release --workspace
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
platform: linux/amd64
ports:
- 64003:1433
command: bash -c "/docker/entrypoint.sh"
environment:
ACCEPT_EULA: "Y"
MSSQL_PID: "Developer"
Expand All @@ -14,8 +15,13 @@ services:
volumes:
- /var/opt/mssql
- type: bind
read_only: true
source: ./static
target: /static
- type: bind
read_only: true
source: ./docker
target: /docker
healthcheck:
test:
- CMD-SHELL
Expand Down
1 change: 1 addition & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/docker/import-chinook.sh & /opt/mssql/bin/sqlservr
18 changes: 18 additions & 0 deletions docker/import-chinook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#run the setup script to create the DB and the schema in the DB
#do this in a loop because the timing for when the SQL instance is ready is indeterminate

PASSWORD="Password!"

for i in {1..50};
do
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "${PASSWORD}" -i /static/chinook-sqlserver.sql
if [ $? -eq 0 ]
then
echo "setup.sql completed"
break
else
echo "not ready yet..."
sleep 1
fi
done

3 changes: 0 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ test-integrated:

# run sqlserver
start-dependencies:
# start sqlserver
docker compose down -v sqlserver
docker compose up --wait sqlserver
docker exec -it ndc-sqlserver-sqlserver-1 /opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P "Password!" -i "/static/chinook-sqlserver.sql"

# run prometheus + grafana
start-metrics:
Expand Down

0 comments on commit 17e408b

Please sign in to comment.