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:
7
7
volumes :
8
8
- .:/var/www
9
9
depends_on :
10
- - ${COMPOSE_PROFILES-postgres}
10
+ mssql : { condition: service_healthy }
11
+ # [ "${COMPOSE_PROFILES-postgres}" ]
11
12
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
13
14
postgres :
14
15
profiles : ["postgres"]
15
16
ports : ["5432:5432"]
16
17
image : postgres
17
18
environment :
18
19
POSTGRES_USER : root
19
20
POSTGRES_DB : sqlpage
20
- POSTGRES_PASSWORD : secret
21
+ POSTGRES_PASSWORD : Password123!
21
22
mysql :
22
23
profiles : ["mysql"]
23
24
ports : ["3306:3306"]
24
25
image : mysql
25
26
environment :
26
- MYSQL_ROOT_PASSWORD : secret
27
+ MYSQL_ROOT_PASSWORD : Password123!
27
28
MYSQL_DATABASE : sqlpage
28
29
mssql :
29
30
profiles : ["mssql"]
30
31
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
7
7
8
8
# Bundle config source
9
9
COPY entrypoint.sh /usr/config/entrypoint.sh
10
- COPY configure-db.sh /usr/config/configure-db.sh
11
10
COPY setup.sql /usr/config/setup.sql
12
11
13
12
# Grant permissions for to our scripts to be executable
14
13
USER root
15
14
RUN chmod +x /usr/config/entrypoint.sh
16
- RUN chmod +x /usr/config/configure-db.sh
17
15
RUN chown 10001 /usr/config/entrypoint.sh
18
- RUN chown 10001 /usr/config/configure-db.sh
19
16
USER 10001
20
17
21
18
ENV SA_PASSWORD="Password123!"
22
19
ENV ACCEPT_EULA="Y"
23
20
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
+
24
24
ENTRYPOINT ["/usr/config/entrypoint.sh" ]
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- # Start the script to create the DB and user
4
- /usr/config/configure-db.sh &
3
+ /opt/mssql/bin/sqlservr &
4
+ pid= $!
5
5
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 7
7
USE sqlpage;
8
8
GO
9
9
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 ;
12
12
GO
You can’t perform that action at this time.
0 commit comments