forked from dotnet/SqlClient
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Docker debugging with Docker Compose orchestration support (d…
- Loading branch information
1 parent
68eff11
commit 5ceec82
Showing
12 changed files
with
440 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/azds.yaml | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/azds.yaml | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md |
Large diffs are not rendered by default.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
src/Microsoft.Data.SqlClient/tests/DockerLinuxTest/Dockerfile
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,23 @@ | ||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. | ||
|
||
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-buster-slim AS base | ||
WORKDIR /app | ||
|
||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build | ||
WORKDIR /sqlclient | ||
COPY . . | ||
|
||
ARG PROJNAME="Microsoft.Data.SqlClient.DockerLinuxTest" | ||
ARG PROJFILE=$PROJNAME".csproj" | ||
ARG DLLFILE=$PROJNAME".dll" | ||
|
||
WORKDIR /sqlclient/src/Microsoft.Data.SqlClient/tests/DockerLinuxTest | ||
RUN dotnet build $PROJFILE -c Release -o /app/build -p:OSGroup=Unix -p:GenerateDocumentationFile=false | ||
|
||
FROM build AS publish | ||
RUN dotnet publish $PROJFILE -c Release -o /app/publish -p:OSGroup=Unix -p:GenerateDocumentationFile=false | ||
|
||
FROM base AS final | ||
WORKDIR /app | ||
COPY --from=publish /app/publish . | ||
ENTRYPOINT ["dotnet", $DLLFILE] |
15 changes: 15 additions & 0 deletions
15
...soft.Data.SqlClient/tests/DockerLinuxTest/Microsoft.Data.SqlClient.DockerLinuxTest.csproj
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,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | ||
<DockerfileContext>..\..\..\..</DockerfileContext> | ||
<OSGroup>Unix</OSGroup> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.10" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\netcore\src\Microsoft.Data.SqlClient.csproj" /> | ||
</ItemGroup> | ||
</Project> |
28 changes: 28 additions & 0 deletions
28
src/Microsoft.Data.SqlClient/tests/DockerLinuxTest/Program.cs
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,28 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using Microsoft.Data.SqlClient; | ||
|
||
namespace Microsoft.Data.SqlClient.DockerLinuxTest | ||
{ | ||
class Program | ||
{ | ||
static string server = "microsoft.sqlserver"; | ||
static string user = "sa"; | ||
// Provide password as set in docker-compose.yml | ||
static string pwd = "P@ssw0rd!123"; | ||
|
||
static void Main(string[] args) | ||
{ | ||
using (SqlConnection sqlConnection = new SqlConnection($"Server={server}; UID={user}; PWD={pwd}")) | ||
{ | ||
sqlConnection.Open(); | ||
Console.WriteLine($"Connected to SQL Server v{sqlConnection.ServerVersion} from {Environment.OSVersion.VersionString}"); | ||
// Write your code here to debug inside Docker Linux containers. | ||
} | ||
} | ||
} | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
src/Microsoft.Data.SqlClient/tests/DockerLinuxTest/Properties/launchSettings.json
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 @@ | ||
{ | ||
"profiles": { | ||
"Microsoft.Data.SqlClient.DockerLinuxTest": { | ||
"commandName": "Project" | ||
}, | ||
"Docker": { | ||
"commandName": "Docker" | ||
} | ||
} | ||
} |
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,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk"> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectVersion>2.1</ProjectVersion> | ||
<DockerTargetOS>Linux</DockerTargetOS> | ||
<ProjectGuid>f5df2fdc-c860-4cb3-8b24-7c903c6fc076</ProjectGuid> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DockerServiceName>microsoft.data.sqlclient.dockertests</DockerServiceName> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<None Include=".dockerignore" /> | ||
<None Include="docker-compose.override.yml"> | ||
<DependentUpon>docker-compose.yml</DependentUpon> | ||
</None> | ||
<None Include="docker-compose.yml" /> | ||
</ItemGroup> | ||
</Project> |
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 @@ | ||
version: '3.4' | ||
services: | ||
microsoft.data.sqlclient.dockertests: |
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,18 @@ | ||
version: '3.4' | ||
|
||
services: | ||
microsoft.data.sqlclient.dockertests: | ||
image: ${DOCKER_REGISTRY-}microsoftdatasqlclientdockerlinuxtest | ||
build: | ||
context: ../ | ||
dockerfile: src/Microsoft.Data.SqlClient/tests/DockerLinuxTest/Dockerfile | ||
depends_on: | ||
- microsoft.sqlserver | ||
|
||
microsoft.sqlserver: | ||
image: mcr.microsoft.com/mssql/server:2019-latest | ||
environment: | ||
- SA_PASSWORD=P@ssw0rd!123 | ||
- ACCEPT_EULA=Y | ||
ports: | ||
- "5434:1433" |
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,25 +1,33 @@ | ||
{ | ||
"tool": "Credential Scanner", | ||
"suppressions": [ | ||
{ | ||
"file": "TdsServerCertificate.pfx", | ||
"_justification": "The dummy certificate used for internal testing" | ||
}, | ||
{ | ||
"file": "config.ps1", | ||
"_justification": "Contains dummy passwords used for internal testing" | ||
}, | ||
{ | ||
"file": "SqlConnectionBasicTests.cs", | ||
"_justification": "Contains dummy passwords used for internal testing" | ||
}, | ||
{ | ||
"file": "ExceptionTest.cs", | ||
"_justification": "Contains dummy passwords used for internal testing" | ||
}, | ||
{ | ||
"file": "TDSServerArguments.cs", | ||
"_justification": "Contains dummy passwords used for internal testing" | ||
} | ||
] | ||
} | ||
"tool": "Credential Scanner", | ||
"suppressions": [ | ||
{ | ||
"file": "TdsServerCertificate.pfx", | ||
"_justification": "The dummy certificate used for internal testing" | ||
}, | ||
{ | ||
"file": "config.ps1", | ||
"_justification": "Contains dummy passwords used for internal testing" | ||
}, | ||
{ | ||
"file": "SqlConnectionBasicTests.cs", | ||
"_justification": "Contains dummy passwords used for internal testing" | ||
}, | ||
{ | ||
"file": "ExceptionTest.cs", | ||
"_justification": "Contains dummy passwords used for internal testing" | ||
}, | ||
{ | ||
"file": "TDSServerArguments.cs", | ||
"_justification": "Contains dummy passwords used for internal testing" | ||
}, | ||
{ | ||
"file": "Program.cs", | ||
"_justification": "Contains dummy passwords used for docker testing" | ||
}, | ||
{ | ||
"file": "docker-compose.yml", | ||
"_justification": "Contains dummy passwords used for docker testing" | ||
} | ||
] | ||
} |