Compare commits
No commits in common. "3e0130a7672694f5a11b7e2c0b56e0ba6a14f528" and "d1b9ae6fe81d2a1f021a8da94d8ad303e002c2c1" have entirely different histories.
3e0130a767
...
d1b9ae6fe8
|
@ -1,86 +0,0 @@
|
||||||
name: MSSQL
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-2022:
|
|
||||||
name: Build MSSQL 2022
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 300
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v4
|
|
||||||
with:
|
|
||||||
images: ghcr.io/aldy505/mssql-2022
|
|
||||||
flavor: |
|
|
||||||
latest=true
|
|
||||||
tags: |
|
|
||||||
type=sha
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
context: "{{defaultContext}}:mssql-2022"
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
|
|
||||||
build-2019:
|
|
||||||
name: Build MSSQL 2019
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 300
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v4
|
|
||||||
with:
|
|
||||||
images: ghcr.io/aldy505/mssql-2019
|
|
||||||
flavor: |
|
|
||||||
latest=true
|
|
||||||
tags: |
|
|
||||||
type=sha
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
context: "{{defaultContext}}:mssql-2019"
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
|
@ -1,17 +0,0 @@
|
||||||
FROM mcr.microsoft.com/mssql/server:2022-CU16-ubuntu-20.04
|
|
||||||
|
|
||||||
RUN openssl req -x509 -nodes -newkey rsa:2048 -subj '/CN=mssql' -addext "subjectAltName = DNS:mssql" -keyout /etc/ssl/private/mssql.key -out /etc/ssl/certs/mssql.pem -days 7
|
|
||||||
RUN chmod 400 /etc/ssl/private/mssql.key
|
|
||||||
RUN chmod 400 /etc/ssl/certs/mssql.pem
|
|
||||||
RUN mkdir -p /var/opt/mssql
|
|
||||||
COPY mssql.conf /var/opt/mssql/mssql.conf
|
|
||||||
|
|
||||||
|
|
||||||
# Create a config directory
|
|
||||||
RUN mkdir -p /usr/config
|
|
||||||
WORKDIR /usr/config
|
|
||||||
|
|
||||||
# Bundle config source
|
|
||||||
COPY . /usr/config
|
|
||||||
|
|
||||||
ENTRYPOINT ["./entrypoint.sh"]
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Wait 60 seconds for SQL Server to start up by ensuring that
|
|
||||||
# calling SQLCMD does not return an error code, which will ensure that sqlcmd is accessible
|
|
||||||
# and that system and user databases return "0" which means all databases are in an "online" state
|
|
||||||
# https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-databases-transact-sql?view=sql-server-2017
|
|
||||||
|
|
||||||
DBSTATUS=1
|
|
||||||
ERRCODE=1
|
|
||||||
i=0
|
|
||||||
|
|
||||||
while [[ $DBSTATUS -ne 0 ]] && [[ $i -lt 60 ]] && [[ $ERRCODE -ne 0 ]]; do
|
|
||||||
i=$i+1
|
|
||||||
DBSTATUS=$(/opt/mssql-tools/bin/sqlcmd -h -1 -t 1 -U sa -P $MYSQL_SA_PASSWORD -Q "SET NOCOUNT ON; Select SUM(state) from sys.databases")
|
|
||||||
ERRCODE=$?
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ $DBSTATUS -ne 0 ] OR [ $ERRCODE -ne 0 ]; then
|
|
||||||
echo "SQL Server took more than 60 seconds to start up or one or more databases are not in an ONLINE state"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run the setup script to create the DB and the schema in the DB
|
|
||||||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $MYSQL_SA_PASSWORD -d master -i setup.sql
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Start the script to create the DB and user
|
|
||||||
/usr/config/configure-db.sh &
|
|
||||||
|
|
||||||
# Start SQL Server
|
|
||||||
/opt/mssql/bin/sqlservr
|
|
|
@ -1,5 +0,0 @@
|
||||||
[network]
|
|
||||||
tlscert = /etc/ssl/certs/mssql.pem
|
|
||||||
tlskey = /etc/ssl/private/mssql.key
|
|
||||||
tlsprotocols = 1.2
|
|
||||||
forceencryption = 1
|
|
|
@ -1,6 +0,0 @@
|
||||||
/*
|
|
||||||
Enter custom T-SQL here that would run after SQL Server has started up.
|
|
||||||
*/
|
|
||||||
|
|
||||||
CREATE DATABASE $(MSSQL_DB);
|
|
||||||
GO
|
|
|
@ -1,17 +0,0 @@
|
||||||
FROM mcr.microsoft.com/mssql/server:2019-CU29-GDR1-ubuntu-20.04
|
|
||||||
|
|
||||||
RUN openssl req -x509 -nodes -newkey rsa:2048 -subj '/CN=mssql' -addext "subjectAltName = DNS:mssql" -keyout /etc/ssl/private/mssql.key -out /etc/ssl/certs/mssql.pem -days 7
|
|
||||||
RUN chmod 400 /etc/ssl/private/mssql.key
|
|
||||||
RUN chmod 400 /etc/ssl/certs/mssql.pem
|
|
||||||
RUN mkdir -p /var/opt/mssql
|
|
||||||
COPY mssql.conf /var/opt/mssql/mssql.conf
|
|
||||||
|
|
||||||
|
|
||||||
# Create a config directory
|
|
||||||
RUN mkdir -p /usr/config
|
|
||||||
WORKDIR /usr/config
|
|
||||||
|
|
||||||
# Bundle config source
|
|
||||||
COPY . /usr/config
|
|
||||||
|
|
||||||
ENTRYPOINT ["./entrypoint.sh"]
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Wait 60 seconds for SQL Server to start up by ensuring that
|
|
||||||
# calling SQLCMD does not return an error code, which will ensure that sqlcmd is accessible
|
|
||||||
# and that system and user databases return "0" which means all databases are in an "online" state
|
|
||||||
# https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-databases-transact-sql?view=sql-server-2017
|
|
||||||
|
|
||||||
DBSTATUS=1
|
|
||||||
ERRCODE=1
|
|
||||||
i=0
|
|
||||||
|
|
||||||
while [[ $DBSTATUS -ne 0 ]] && [[ $i -lt 60 ]] && [[ $ERRCODE -ne 0 ]]; do
|
|
||||||
i=$i+1
|
|
||||||
DBSTATUS=$(/opt/mssql-tools/bin/sqlcmd -h -1 -t 1 -U sa -P $MYSQL_SA_PASSWORD -Q "SET NOCOUNT ON; Select SUM(state) from sys.databases")
|
|
||||||
ERRCODE=$?
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ $DBSTATUS -ne 0 ] OR [ $ERRCODE -ne 0 ]; then
|
|
||||||
echo "SQL Server took more than 60 seconds to start up or one or more databases are not in an ONLINE state"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run the setup script to create the DB and the schema in the DB
|
|
||||||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $MYSQL_SA_PASSWORD -d master -i setup.sql
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Start the script to create the DB and user
|
|
||||||
/usr/config/configure-db.sh &
|
|
||||||
|
|
||||||
# Start SQL Server
|
|
||||||
/opt/mssql/bin/sqlservr
|
|
|
@ -1,5 +0,0 @@
|
||||||
[network]
|
|
||||||
tlscert = /etc/ssl/certs/mssql.pem
|
|
||||||
tlskey = /etc/ssl/private/mssql.key
|
|
||||||
tlsprotocols = 1.2
|
|
||||||
forceencryption = 1
|
|
|
@ -1,6 +0,0 @@
|
||||||
/*
|
|
||||||
Enter custom T-SQL here that would run after SQL Server has started up.
|
|
||||||
*/
|
|
||||||
|
|
||||||
CREATE DATABASE $(MSSQL_DB);
|
|
||||||
GO
|
|
Loading…
Reference in New Issue