Skip to content

Commit

Permalink
Add Docker Compose Project for DICOM Server in Visual Studio (#806)
Browse files Browse the repository at this point in the history
- Add DICOM Server docker compose project
- Refactor Dockerfiles and folder structure
- Remove dependency on submodule now that Azurite Docker container supports table storage
  • Loading branch information
wsugarman authored Jun 2, 2021
1 parent 4d64f3b commit d08a327
Show file tree
Hide file tree
Showing 28 changed files with 257 additions and 158 deletions.
11 changes: 6 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[project.json]
indent_size = 2

# Generated code
[*{_AssemblyInfo.cs,.notsupported.cs,.Generated.cs}]
generated_code = true
Expand Down Expand Up @@ -224,10 +221,10 @@ curly_bracket_next_line = true
indent_brace_style = Allman

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
[*.{csproj,dcproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2

[*.{csproj,vbproj,proj,nativeproj,locproj}]
[*.{csproj,dcproj,vbproj,proj,nativeproj,locproj}]
charset = utf-8

# Xml build files
Expand All @@ -242,6 +239,10 @@ indent_size = 2
[*.{props,targets,config,nuspec}]
indent_size = 2

# JSON files
[*.json]
indent_size = 2

# YAML files
[*.{yml,yaml}]
indent_size = 2
Expand Down
10 changes: 9 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ updates:
open-pull-requests-limit: 30

- package-ecosystem: "docker"
directory: "/build/docker"
directory: "/docker"
schedule:
interval: "daily"
time: "09:00"
timezone: "America/Los_Angeles"
open-pull-requests-limit: 30

- package-ecosystem: "docker"
directory: "/src/Microsoft.Health.Dicom.Web"
schedule:
interval: "daily"
time: "09:00"
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: build-docker-files

on:
push:
branches:
branches:
- main
pull_request:
branches:
Expand All @@ -13,19 +13,15 @@ jobs:
# create a quick build to get sane output and error messages
runs-on: ubuntu-latest
steps:
-
- name: Checkout repository
uses: actions/[email protected]
with:
submodules: true
-
# sample contains all the docker files
name: Build all docker files

- name: Build all docker files
run: |
docker-compose build
working-directory: samples/docker
-
name: test-docker

- name: Test Docker Sample
run: .github/workflows/test-docker.ps1
shell: pwsh
timeout-minutes: 6

6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ jobs:
# Build C# solutions manually
- name: dotnet build
run: |
dotnet build Microsoft.Health.Dicom.sln -c Release -p:ContinuousIntegrationBuild=true
dotnet build converter/dicom-cast/Microsoft.Health.DicomCast.sln -c Release -p:ContinuousIntegrationBuild=true
dotnet build tools/scale-testing/ScaleTesting.sln -c Release -p:ContinuousIntegrationBuild=true
dotnet build Microsoft.Health.Dicom.sln -c Release -p:ContinuousIntegrationBuild=true -warnaserror
dotnet build converter/dicom-cast/Microsoft.Health.DicomCast.sln -c Release -p:ContinuousIntegrationBuild=true -warnaserror
dotnet build tools/scale-testing/ScaleTesting.sln -c Release -p:ContinuousIntegrationBuild=true -warnaserror
if: ${{ matrix.language == 'csharp' }}

- name: Perform CodeQL Analysis
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-docker.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#region start docker
<#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="random test password for sql")]#>
$env:SAPASSWORD='123!@#passforCI#$'
$env:SAPASSWORD='123!@#passforCI#$'
docker-compose -f samples/docker/docker-compose.yaml up -d
echo 'docker up'
#endregion
Expand All @@ -11,7 +11,7 @@ echo 'docker up'
do {
sleep 1
curl localhost:8080/health/check -f
} while($LASTEXITCODE -ne 0)
} while($LASTEXITCODE -ne 0)
echo 'dicom-api healthy'
#endregion

Expand Down
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

4 changes: 3 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
</Otherwise>
</Choose>

<ItemGroup>
<!-- Dotnet CLI throws errors on restore if package references are included in docker compose projects -->
<!-- See microsoft/DockerTools#209 for details -->
<ItemGroup Condition="'$(MSBuildProjectExtension)' != '.dcproj'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

Expand Down
16 changes: 11 additions & 5 deletions Microsoft.Health.Dicom.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
global.json = global.json
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Health.Dicom.Web", "src\Microsoft.Health.Dicom.Web\Microsoft.Health.Dicom.Web.csproj", "{BFB96311-9B1A-41C1-ABF1-4F6522660084}"
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker\docker-compose.dcproj", "{336B1FB4-EEF8-4E11-BDD5-818983D4E1CD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8C9A0050-5D22-4398-9F93-DDCD80B3BA51}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Health.Dicom.Web", "src\Microsoft.Health.Dicom.Web\Microsoft.Health.Dicom.Web.csproj", "{BFB96311-9B1A-41C1-ABF1-4F6522660084}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Health.Dicom.Web.Tests.E2E", "test\Microsoft.Health.Dicom.Web.Tests.E2E\Microsoft.Health.Dicom.Web.Tests.E2E.csproj", "{1D0ECFDA-2AF2-4796-995D-A7C6E18C9CD1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{176641B3-297C-4E04-A83D-8F80F80485E8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Health.Dicom.Blob", "src\Microsoft.Health.Dicom.Blob\Microsoft.Health.Dicom.Blob.csproj", "{1FFFABFB-B30A-4AB8-8193-67016B1C5276}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Health.Dicom.Tests.Integration", "test\Microsoft.Health.Dicom.Tests.Integration\Microsoft.Health.Dicom.Tests.Integration.csproj", "{DFB41ECC-726C-4DBA-8AD3-17FB0A2546CA}"
Expand All @@ -41,6 +39,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Health.Dicom.SqlS
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Health.Dicom.Client", "src\Microsoft.Health.Dicom.Client\Microsoft.Health.Dicom.Client.csproj", "{D100EA60-8DC8-4576-A177-56BC7193BF4A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{176641B3-297C-4E04-A83D-8F80F80485E8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8C9A0050-5D22-4398-9F93-DDCD80B3BA51}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -99,6 +101,10 @@ Global
{D100EA60-8DC8-4576-A177-56BC7193BF4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D100EA60-8DC8-4576-A177-56BC7193BF4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D100EA60-8DC8-4576-A177-56BC7193BF4A}.Release|Any CPU.Build.0 = Release|Any CPU
{336B1FB4-EEF8-4E11-BDD5-818983D4E1CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{336B1FB4-EEF8-4E11-BDD5-818983D4E1CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{336B1FB4-EEF8-4E11-BDD5-818983D4E1CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{336B1FB4-EEF8-4E11-BDD5-818983D4E1CD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -119,7 +125,7 @@ Global
{D100EA60-8DC8-4576-A177-56BC7193BF4A} = {176641B3-297C-4E04-A83D-8F80F80485E8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E370FB31-CF95-47D1-B1E1-863A77973FF8}
RESX_SortFileContentOnSave = True
SolutionGuid = {E370FB31-CF95-47D1-B1E1-863A77973FF8}
EndGlobalSection
EndGlobal
10 changes: 0 additions & 10 deletions build/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ parameters:
analyzeSecurity: true

steps:
- checkout: self
submodules: true # Remove once the submodules no longer cause build warnings

- task: DeleteFiles@1
displayName: 'Remove Submodule'
inputs:
SourceFolder: '$(Build.SourcesDirectory)/samples/Azurite'
Contents: '*'
RemoveSourceFolder: true

- task: UseDotNet@2
displayName: 'Use .NET Core sdk (for sql generation)'
inputs:
Expand Down
2 changes: 1 addition & 1 deletion build/ci-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ variables:
buildConfiguration: 'Release'
imageTag: '$(build.BuildNumber)'
azureContainerRegistry: 'dicomoss.azurecr.io'
dicomServerComposeLocation: 'build/docker/docker-compose.yaml'
dicomServerComposeLocation: 'docker/docker-compose.yaml'
dicomCastComposeLocation: 'converter/dicom-cast/build/docker/docker-compose.yaml'
skipNugetSecurityAnalysis: 'true' # NuGet config contains multiple feeds but meets exception criteria
34 changes: 0 additions & 34 deletions build/docker/Dockerfile

This file was deleted.

6 changes: 0 additions & 6 deletions build/docker/docker-compose.yaml

This file was deleted.

1 change: 0 additions & 1 deletion build/update-semver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ steps:
configFilePath: 'GitVersion.yml'
targetPath: '$(Build.SourcesDirectory)'
useConfigFile: true

2 changes: 1 addition & 1 deletion converter/dicom-cast/build/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ WORKDIR /dicom-cast/src
COPY ./ ./

# Execute a dotnet build and publish the hosting project
RUN dotnet build "./converter/dicom-cast/src/Microsoft.Health.DicomCast.Hosting/Microsoft.Health.DicomCast.Hosting.csproj" --configuration Release
RUN dotnet build "./converter/dicom-cast/src/Microsoft.Health.DicomCast.Hosting/Microsoft.Health.DicomCast.Hosting.csproj" --configuration Release -warnaserror
RUN dotnet publish "./converter/dicom-cast/src/Microsoft.Health.DicomCast.Hosting/Microsoft.Health.DicomCast.Hosting.csproj" -c Release -o "/.build" --no-build

# Build the runtime image
Expand Down
25 changes: 25 additions & 0 deletions docker/.dockerignore
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
33 changes: 33 additions & 0 deletions docker/docker-compose.dcproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?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>336b1fb4-eef8-4e11-bdd5-818983d4e1cd</ProjectGuid>
<DockerComposeProjectName>Dicom</DockerComposeProjectName>
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}</DockerServiceUrl>
<DockerServiceName>microsoft.health.dicom.web</DockerServiceName>
<AdditionalComposeFilePaths>docker-compose.dependencies.yml;docker-compose.vs.yml</AdditionalComposeFilePaths>
</PropertyGroup>

<ItemGroup>
<None Include="docker-compose.dependencies.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.vs.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.vs.debug.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.vs.release.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
<None Include="sql\Dockerfile" />
<None Include=".dockerignore" />
</ItemGroup>

</Project>
27 changes: 27 additions & 0 deletions docker/docker-compose.dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: "3.4"

services:
microsoft.health.dicom.web:
environment:
SqlServer__ConnectionString: "Server=tcp:sql,1433;Initial Catalog=DICOM;Persist Security Info=False;User ID=sa;Password=${SAPASSWORD};MultipleActiveResultSets=False;Connection Timeout=30;"
SqlServer__AllowDatabaseCreation: "true"
SqlServer__Initialize: "true"
BlobStore__ConnectionString: "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;"
DataStore: "SqlServer"
depends_on:
- sql
- azurite
azurite:
image: mcr.microsoft.com/azure-storage/azurite
sql:
build:
context: ./..
dockerfile: docker/sql/Dockerfile
environment:
SA_PASSWORD: ${SAPASSWORD}
ACCEPT_EULA: "Y"
healthcheck:
test: ["CMD", "/opt/mssql-tools/bin/sqlcmd","-U sa -P ${SAPASSWORD} -Q 'SELECT * FROM INFORMATION_SCHEMA.TABLES'"]
interval: 10s
timeout: 10s
retries: 6
7 changes: 7 additions & 0 deletions docker/docker-compose.vs.debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "3.4"

services:
microsoft.health.dicom.web:
build:
args:
BUILD_CONFIGURATION: "Debug"
7 changes: 7 additions & 0 deletions docker/docker-compose.vs.release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "3.4"

services:
microsoft.health.dicom.web:
build:
args:
BUILD_CONFIGURATION: "Release"
23 changes: 23 additions & 0 deletions docker/docker-compose.vs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: "3.4"

services:
microsoft.health.dicom.web:
image: ${DOCKER_REGISTRY-}microsofthealthdicomweb
environment:
ASPNETCORE_ENVIRONMENT: "Development"
ASPNETCORE_URLS: "https://+:8080"
DicomServer__Security__Enabled: "false"
# [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Password is only used for development.")]
SqlServer__ConnectionString: "Server=tcp:sql,1433;Initial Catalog=DICOM;Persist Security Info=False;User ID=sa;Password=${SAPASSWORD:-L0ca1P@ssw0rd};MultipleActiveResultSets=False;Connection Timeout=30;"
user: root
ports:
- "63839:8080"
volumes:
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
sql:
environment:
# [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Password is only used for development.")]
SA_PASSWORD: ${SAPASSWORD:-L0ca1P@ssw0rd}
healthcheck:
# [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Password is only used for development.")]
test: ["CMD", "/opt/mssql-tools/bin/sqlcmd","-U sa -P ${SAPASSWORD:-L0ca1P@ssw0rd} -Q 'SELECT * FROM INFORMATION_SCHEMA.TABLES'"]
7 changes: 7 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "3.4"

services:
microsoft.health.dicom.web:
build:
context: ./..
dockerfile: src/Microsoft.Health.Dicom.Web/Dockerfile
Loading

0 comments on commit d08a327

Please sign in to comment.