File tree Expand file tree Collapse file tree 5 files changed +27
-21
lines changed Expand file tree Collapse file tree 5 files changed +27
-21
lines changed Original file line number Diff line number Diff line change @@ -7,25 +7,32 @@ services:
77 volumes :
88 - .:/var/www
99 depends_on :
10- - ${COMPOSE_PROFILES-postgres}
10+ mssql : { condition: service_healthy }
11+ # [ "${COMPOSE_PROFILES-postgres}" ]
1112 environment :
12- DATABASE_URL : ${COMPOSE_PROFILES-postgres}://root:secret @${COMPOSE_PROFILES:-postgres}/sqlpage
13+ DATABASE_URL : ${COMPOSE_PROFILES-postgres}://root:Password123! @${COMPOSE_PROFILES:-postgres}/sqlpage
1314 postgres :
1415 profiles : ["postgres"]
1516 ports : ["5432:5432"]
1617 image : postgres
1718 environment :
1819 POSTGRES_USER : root
1920 POSTGRES_DB : sqlpage
20- POSTGRES_PASSWORD : secret
21+ POSTGRES_PASSWORD : Password123!
2122 mysql :
2223 profiles : ["mysql"]
2324 ports : ["3306:3306"]
2425 image : mysql
2526 environment :
26- MYSQL_ROOT_PASSWORD : secret
27+ MYSQL_ROOT_PASSWORD : Password123!
2728 MYSQL_DATABASE : sqlpage
2829 mssql :
2930 profiles : ["mssql"]
3031 ports : ["1433:1433"]
31- build : { context: "mssql" }
32+ build : { context: "mssql" }
33+ healthcheck :
34+ test : /opt/mssql-tools/bin/sqlcmd -S localhost -U root -P "Password123!" -Q "SELECT 1" -b -o /dev/null
35+ interval : 10s
36+ timeout : 3s
37+ retries : 10
38+ start_period : 10s
Original file line number Diff line number Diff line change @@ -7,18 +7,18 @@ WORKDIR /usr/config
77
88# Bundle config source
99COPY entrypoint.sh /usr/config/entrypoint.sh
10- COPY configure-db.sh /usr/config/configure-db.sh
1110COPY setup.sql /usr/config/setup.sql
1211
1312# Grant permissions for to our scripts to be executable
1413USER root
1514RUN chmod +x /usr/config/entrypoint.sh
16- RUN chmod +x /usr/config/configure-db.sh
1715RUN chown 10001 /usr/config/entrypoint.sh
18- RUN chown 10001 /usr/config/configure-db.sh
1916USER 10001
2017
2118ENV SA_PASSWORD="Password123!"
2219ENV ACCEPT_EULA="Y"
2320
21+ HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=10 \
22+ CMD sqlcmd -S localhost -U root -P "Password123!" -Q "SELECT 1" || exit 1
23+
2424ENTRYPOINT ["/usr/config/entrypoint.sh" ]
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- # Start the script to create the DB and user
4- /usr/config/configure-db.sh &
3+ /opt/mssql/bin/sqlservr &
4+ pid= $!
55
6- # Start SQL Server
7- /opt/mssql/bin/sqlservr
6+ # Wait 15 seconds for SQL Server to start up
7+ sleep 15
8+
9+ # Run the setup script to create the DB and the schema in the DB
10+ /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P " $SA_PASSWORD " -d master -i setup.sql
11+
12+ # Wait for sqlservr to exit
13+ wait -n $pid
Original file line number Diff line number Diff line change 77USE sqlpage;
88GO
99
10- CREATE LOGIN root WITH PASSWORD = ' secret ' ;
11- CREATE USER root FOR LOGIN MyUser ;
10+ CREATE LOGIN root WITH PASSWORD = ' Password123! ' ;
11+ CREATE USER root FOR LOGIN root ;
1212GO
You can’t perform that action at this time.
0 commit comments