New: tooling_container
This commit is contained in:
9
Einheit_4/tooling_container/Dockerfile
Normal file
9
Einheit_4/tooling_container/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
||||
FROM mcr.microsoft.com/mssql-tools
|
||||
WORKDIR /App
|
||||
|
||||
# Copy everything
|
||||
COPY ../../Einheit_1/2025_5BHITN_Konstantin_Hintermayer_create_schema.sql ./01.sql
|
||||
COPY ../../Einheit_2/2025_5BHITN_Konstantin_Hintermayer_seed_database.sql ./02.sql
|
||||
COPY ../../Einheit_3/2025_5BHITN_Konstantin_Hintermayer_procedures_and_triggers.sql ./03.sql
|
||||
|
||||
ENTRYPOINT ["sqlcmd", "-D", ""]
|
||||
19
Einheit_4/tooling_container/entrypoint.sh
Executable file
19
Einheit_4/tooling_container/entrypoint.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
# Wait for SQL Server to boot up (adjust sleep if needed)
|
||||
echo "Waiting for SQL Server to start..."
|
||||
sleep 20s
|
||||
|
||||
# Run the three SQL files using sqlcmd
|
||||
# -S: Server, -U: User, -P: Password (passed via ENV)
|
||||
echo "Applying SQL files..."
|
||||
|
||||
for migration in $(ls . | grep -E '\.sql$')
|
||||
do
|
||||
echo "Applying $migration."
|
||||
/opt/mssql-tools/bin/sqlcmd -D $DSN_PASSWORD -i $migration.sql
|
||||
done
|
||||
|
||||
echo "Database initialization complete."
|
||||
|
||||
# Keep the container alive by bringing the background process to the foreground
|
||||
wait
|
||||
Reference in New Issue
Block a user