add mssql

This commit is contained in:
2021-08-18 01:46:32 -05:00
parent 372c1ad35d
commit 1d808a59b2
5 changed files with 58 additions and 0 deletions

3
db/mssql/Dockerfile Normal file
View File

@@ -0,0 +1,3 @@
FROM mcr.microsoft.com/mssql/server:2017-latest
CMD /bin/bash /docker-entrypoint-initdb.d/entrypoint.sh

3
db/mssql/entrypoint.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
/docker-entrypoint-initdb.d/run-initialization.sh & /opt/mssql/bin/sqlservr

27
db/mssql/init.sql Normal file
View File

@@ -0,0 +1,27 @@
EXEC sp_configure 'CONTAINED DATABASE AUTHENTICATION', 1
GO
RECONFIGURE
GO
USE [master]
GO
CREATE DATABASE demo;
GO
ALTER DATABASE [demo] SET CONTAINMENT = PARTIAL
GO
USE [demo];
GO
CREATE USER demo_user WITH PASSWORD = 'pas$w0rd';
GO
CREATE TABLE Products (ID int, ProductName nvarchar(max));
GO
GRANT SELECT ON OBJECT::dbo.Products TO demo_user;
GRANT INSERT ON OBJECT::dbo.Products TO demo_user;
GRANT UPDATE ON OBJECT::dbo.Products TO demo_user;
GRANT DELETE ON OBJECT::dbo.Products TO demo_user;

7
db/mssql/run-initialization.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
# Wait to be sure that SQL Server came up
sleep 20s
# Run the setup script to create the DB and the schema in the DB
# Note: make sure that your password matches what is in the Dockerfile
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P ${SA_PASSWORD} -d master -i /docker-entrypoint-initdb.d/init.sql

View File

@@ -14,6 +14,22 @@ services:
- "MARIADB_ROOT_PASSWORD=admin_pass" - "MARIADB_ROOT_PASSWORD=admin_pass"
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
mssql-db:
image: mssql:2017-latest
build:
context: db/mssql
dockerfile: Dockerfile
volumes:
- "./db/mssql:/docker-entrypoint-initdb.d"
networks:
- default
ports:
- "8085:1433"
environment:
#- "SA_USER=sa"
- "SA_PASSWORD=adm1n_pa%s"
- "ACCEPT_EULA=Y"
mysql-db: mysql-db:
image: mysql image: mysql
volumes: volumes:
@@ -47,5 +63,7 @@ services:
ports: ports:
- "8083:8080" - "8083:8080"
depends_on: depends_on:
- maria-db
- mssql-db
- mysql-db - mysql-db
- postgres-db - postgres-db