-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
80 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,13 @@ name: Publish Docker images for CI/CD | |
on: # yamllint disable-line rule:truthy | ||
push: | ||
paths: | ||
- 'devops/Dockerfile' | ||
- 'devops/**' | ||
- '.github/workflows/publish-docker.yml' | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
publish-docker: | ||
publish-docker-client: | ||
strategy: | ||
matrix: | ||
python_version: ["3.7", "3.8", "3.9", "3.10"] | ||
|
@@ -29,13 +29,42 @@ jobs: | |
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker images | ||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
build-args: PYTHON_VERSION=${{ matrix.python_version }} | ||
file: devops/Dockerfile | ||
file: devops/CI.Dockerfile | ||
push: true | ||
platforms: linux/amd64 | ||
target: ${{ matrix.docker_target }} | ||
tags: ghcr.io/${{ github.repository }}:${{ matrix.python_version }}-${{ matrix.docker_target }} | ||
tags: ghcr.io/${{ github.repository }}:CI-${{ matrix.python_version }}-${{ matrix.docker_target }} | ||
|
||
publish-docker-server: | ||
strategy: | ||
matrix: | ||
mssql_version: ["2017", "2019", "2022"] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
build-args: MSSQL_VERSION=${{ matrix.mssql_version }} | ||
file: devops/server.Dockerfile | ||
push: true | ||
platforms: linux/amd64 | ||
tags: ghcr.io/${{ github.repository }}:server-${{ matrix.mssql_version }} |
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
devops/create_sql_users.sql → devops/scripts/create_sql_users.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
IF NOT EXISTS(SELECT * FROM sys.database_principals WHERE name = '$(DBT_TEST_USER_1)') | ||
CREATE USER [$(DBT_TEST_USER_1)] WITHOUT LOGIN; | ||
|
||
IF NOT EXISTS(SELECT * FROM sys.database_principals WHERE name = '$(DBT_TEST_USER_2)') | ||
CREATE USER [$(DBT_TEST_USER_2)] WITHOUT LOGIN; | ||
|
||
IF NOT EXISTS(SELECT * FROM sys.database_principals WHERE name = '$(DBT_TEST_USER_3)') | ||
CREATE USER [$(DBT_TEST_USER_3)] WITHOUT LOGIN; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
/opt/init_scripts/init_db.sh & /opt/mssql/bin/sqlservr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
for i in {1..50}; | ||
do | ||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "${SA_PASSWORD}" -d msdb -I -i create_sql_users.sql | ||
if [ $? -eq 0 ] | ||
then | ||
echo "create_sql_users.sql completed" | ||
break | ||
else | ||
echo "not ready yet..." | ||
sleep 1 | ||
fi | ||
done |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
ARG MSSQL_VERSION="2022" | ||
FROM mcr.microsoft.com/mssql/server:${MSSQL_VERSION}-latest | ||
|
||
USER root | ||
RUN mkdir -p /opt/init_scripts | ||
WORKDIR /opt/init_scripts | ||
COPY scripts/* /opt/init_scripts/ | ||
|
||
USER mssql | ||
ENTRYPOINT /bin/bash ./entrypoint.sh |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,14 @@ | ||
services: | ||
sqlserver: | ||
image: mcr.microsoft.com/mssql/server:2022-latest | ||
build: | ||
context: devops | ||
dockerfile: server.Dockerfile | ||
args: | ||
MSSQL_VERSION: "2022" | ||
environment: | ||
SA_PASSWORD: "L0calTesting!" | ||
ACCEPT_EULA: "Y" | ||
ports: | ||
- "1433:1433" | ||
|
||
init-db: | ||
image: mcr.microsoft.com/mssql/server:2022-latest | ||
depends_on: | ||
- sqlserver | ||
restart: 'no' | ||
volumes: | ||
- ./devops:/mnt/scripts | ||
environment: | ||
SQLCMDUSER: SA | ||
SQLCMDPASSWORD: "L0calTesting!" | ||
SQLCMDSERVER: sqlserver | ||
SQLCMDDBNAME: msdb | ||
env_file: | ||
- test.env | ||
command: sh -c "/mnt/scripts/wait-for-it.sh sqlserver:1433 -t 60 -- sleep 5 && /opt/mssql-tools/bin/sqlcmd -b -I -i /mnt/scripts/create_sql_users.sql" | ||
ports: | ||
- "1433:1433" |