Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding github actions #2

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Publish Docker image
concurrency: build-${{ github.head_ref || github.ref }}
on:
push:
branches: [ main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: [main]

permissions:
contents: read
packages: write

jobs:
build-and-push-image:
if: ${{ github.event_name == 'push' || (!github.event.pull_request.draft && !startsWith(github.event.pull_request.title, 'WIP ')) }}
runs-on: windows-latest
env:
REGISTRY: ghcr.io
USER: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
SQLCOLLATION: "SQL_Latin1_General_CP1_CI_AS"
MSSQL_SA_PASSWORD: "A.794613"

steps:
- uses: actions/checkout@v4
with:
clean: true
lfs: true
submodules: true

- name: Build
run: docker build -m 4g -t pangaeatech/mssql-server-ltsc2022:latest --build-arg SQLCOLLATION="$env:SQLCOLLATION" .

- name: Test
run: docker run --name test_image -m 4g -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=$env:MSSQL_SA_PASSWORD" -p 51433:1433 -d pangaeatech/mssql-server-ltsc2022:latest && Start-Sleep -Second 15 && Invoke-Sqlcmd -TrustServerCertificate -ServerInstance "localhost,51433" -Database "master" -Username "sa" -Password "$env:MSSQL_SA_PASSWORD" -Query "IF SERVERPROPERTY('ProductVersion') <> '$ProductVersion' RAISERROR ('ProductVersion is invalid', 16, 1)" && Invoke-Sqlcmd -TrustServerCertificate -ServerInstance "localhost,51433" -Database "master" -Username "sa" -Password "$env:MSSQL_SA_PASSWORD" -Query "IF SERVERPROPERTY('Collation') <> '$Collation' RAISERROR ('Collation is invalid', 16, 1)"

- name: Push on main
if: ${{ github.event_name == 'push' }}
run: docker login -u $env:USER -p $env:TOKEN $env:REGISTRY && docker image push "pangaeatech/mssql-server-ltsc2022:latest" && docker logout
18 changes: 0 additions & 18 deletions .github/workflows/testImages.yml

This file was deleted.

33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM mcr.microsoft.com/windows/servercore:ltsc2022

LABEL maintainer "Pangaea Information Technologies, Ltd."

# Download Links:
ENV setup "https://go.microsoft.com/fwlink/?linkid=2215158"
ENV patch "https://catalog.s.download.windowsupdate.com/d/msdownload/update/software/updt/2023/11/sqlserver2022-kb5031778-x64_8e55c5f6d70155e9f7fc190383373917426668a2.exe"

ENV sa_password="_" \
attach_dbs="[]" \
ACCEPT_EULA="_"

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# make install files accessible
COPY start.ps1 /
WORKDIR /

RUN Invoke-WebRequest -Uri $env:setup -OutFile SQL1.exe
RUN .\SQL1.exe /qs /ACTION=Install /INSTANCENAME=MSSQLSERVER /FEATURES=SQLEngine,FullText /UPDATEENABLED=0 /SQLSVCACCOUNT='NT AUTHORITY\NETWORK SERVICE' /SQLSYSADMINACCOUNTS='BUILTIN\ADMINISTRATORS' /TCPENABLED=1 /NPENABLED=0 /IACCEPTSQLSERVERLICENSETERMS /SAPWD=qGH6RFvq /SECURITYMODE=SQL /SQLSVCSTARTUPTYPE=Automatic
RUN Invoke-WebRequest -Uri $env:patch -OutFile SQL2.exe
RUN Start-Process -Wait -FilePath .\SQL2.exe -ArgumentList /qs, /x:patch
RUN .\patch\setup.exe /qs /ACTION=Patch /INSTANCENAME=MSSQLSERVER /IACCEPTSQLSERVERLICENSETERMS
RUN Remove-Item -Recurse -Force SQL1.exe, SQL2.exe, patch

RUN stop-service MSSQLSERVER
RUN set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql14.MSSQLSERVER\mssqlserver\supersocketnetlib\tcp\ipall' -name tcpdynamicports -value ''
RUN set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql14.MSSQLSERVER\mssqlserver\supersocketnetlib\tcp\ipall' -name tcpport -value 1433
RUN set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql14.MSSQLSERVER\mssqlserver\' -name LoginMode -value 2

HEALTHCHECK CMD [ "sqlcmd", "-Q", "select 1" ]

CMD .\start -sa_password $env:sa_password -ACCEPT_EULA $env:ACCEPT_EULA -attach_dbs \"$env:attach_dbs\" -Verbose
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
## Update - October 2023
This project is retired. I no longer find it useful to use images of Microsoft SQL Server on Windows Server 2022 for Docker Engine.
## Featured Tags

### Windows images only

|Tags|Collation|
|--- |---|
|2022-latest|```SQL_Latin1_General_CP1_CI_AS```|

### SQL Server Developer Edition only

|Tags prefix|Product|Version|Release date|
|--- |--- |--- |---|
|2022-latest...|SQL Server 2022 CU8|16.0.4075.1|2023-09-14|

## Configuration
Requires the following environment flags:
- ```ACCEPT_EULA=Y```
- ```MSSQL_SA_PASSWORD=```

## Build

All images are based on [.NET Framework Runtime](https://hub.docker.com/_/microsoft-dotnet-framework-runtime) in particular:

|Product|Base image|Release date|
|--- |--- |---|
|SQL Server 2022|mcr.microsoft.com/dotnet/framework/runtime:<br/>4.8.1-20230808-windowsservercore-ltsc2022|2023-08-08|
10 changes: 0 additions & 10 deletions developer/2012-latest/dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions developer/2014-latest/dockerfile

This file was deleted.

32 changes: 0 additions & 32 deletions developer/2014-latest/start.ps1

This file was deleted.

10 changes: 0 additions & 10 deletions developer/2016-latest/dockerfile

This file was deleted.

32 changes: 0 additions & 32 deletions developer/2016-latest/start.ps1

This file was deleted.

10 changes: 0 additions & 10 deletions developer/2017-latest/dockerfile

This file was deleted.

32 changes: 0 additions & 32 deletions developer/2017-latest/start.ps1

This file was deleted.

10 changes: 0 additions & 10 deletions developer/2019-latest/dockerfile

This file was deleted.

32 changes: 0 additions & 32 deletions developer/2019-latest/start.ps1

This file was deleted.

10 changes: 0 additions & 10 deletions developer/2022-latest/dockerfile

This file was deleted.

32 changes: 0 additions & 32 deletions developer/2022-latest/start.ps1

This file was deleted.

31 changes: 0 additions & 31 deletions developer/build.ps1

This file was deleted.

Loading
Loading