Skip to content

Commit

Permalink
feat:MB: add docker file
Browse files Browse the repository at this point in the history
Creating container for docker
  • Loading branch information
maurobernal committed May 10, 2024
1 parent ac86414 commit 818acfa
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 35 deletions.
30 changes: 30 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
**/.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
!**/.gitignore
!.git/HEAD
!.git/config
!.git/packed-refs
!.git/refs/heads/**
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageVersion Include="Moq" Version="4.20.69" />
<PackageVersion Include="NSwag.AspNetCore" Version="14.0.3" />
<PackageVersion Include="NSwag.MSBuild" Version="14.0.3" />
Expand Down
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#Runtime
FROM maurobernal/net8-base as base
USER root
WORKDIR /app
EXPOSE 80
EXPOSE 443
ENV ASPNETCORE_HTTP_PORTS=80;
ENV ASPNETCORE_HTTPS_PORTS=443;
ENV ASPNETCORE_URLS=http://*:80/;https://*:443/;
ENV ASPNETCORE_Kestrel__Certificates__Default__Path=/root/.aspnet/https/CertificadoCA.pfx
ENV ASPNETCORE_Kestrel__Certificates__Default__Password=Pass2024!
WORKDIR /root/
COPY https .aspnet/https/

#Build
FROM maurobernal/net8-build AS build

##Pass Solution
WORKDIR /
COPY . .

WORKDIR /src/
RUN dotnet build Web/Web.csproj -c Release -o /app/build


##########################################
FROM build as publish
USER root
RUN dotnet publish Web/Web.csproj -c Release -o /app/publish
FROM base as final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT [ "dotnet" , "ca.Web.dll"]
31 changes: 31 additions & 0 deletions https/CertificadoCA.cer
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-----BEGIN CERTIFICATE-----
MIIFWjCCBEKgAwIBAgITFgAAAD1anHKm1G7gpAABAAAAPTANBgkqhkiG9w0BAQsF
ADBCMRUwEwYKCZImiZPyLGQBGRYFTE9DQUwxEzARBgoJkiaJk/IsZAEZFgNHQUcx
FDASBgNVBAMTC0dBRy1BQzAyLUNBMB4XDTI0MDUxMDIxMjY1MloXDTI2MDUxMDIx
MjY1MlowXDELMAkGA1UEBhMCQVIxEDAOBgNVBAgTB01lbmRvemExEDAOBgNVBAcT
B01lbmRvemExCzAJBgNVBAoTAk1CMQswCQYDVQQLEwJJVDEPMA0GA1UEAxMGY2Eu
d2ViMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuDXVgM9vkCWDjQJx
ymKZwF9lFL4AHEpCSE5EgIpguP7d2hizycnYefwjxB/tu8/kKh4RGtPC1hqJV9eA
cXnKEEFEQQCIndLSoxbZ/Uvu4+QNgmohoWhDe+8uX+/BfvOGt6FYraAyTu3lQilH
Zsc/UYkKVLmTEMAVRVUzLKtaMqI6UcMr8JoLPLWbJZ+gFEKhqdFNQqOjV1VFz3DV
6ACRxSbTSc+anPUPcbhhGU92cvsqPb8lptiXdYht6TodGEquZhURGi5kQTufEtoW
cOhPjHE7r3Gps5HnTADpttVOZNa3H0GfxDYc6a3zh7WPx0r+CWIKB4jVUmtuX0gz
h+KUKQIDAQABo4ICLTCCAik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4QKRnyapXXUnhdbjPZjx
bkf4fn7BZHFtweuyWjTKdRjIz5F9QwNV0GHL3Xoh
-----END CERTIFICATE-----
24 changes: 24 additions & 0 deletions https/pedidoCAweb.req
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-----BEGIN NEW CERTIFICATE REQUEST-----
MIIEEjCCAvoCAQAwbTEQMA4GA1UECAwHTWVuZG96YTELMAkGA1UECwwCSVQxCzAJ
BgNVBAoMAk1CMRAwDgYDVQQHDAdNZW5kb3phMQ8wDQYDVQQqDAZjYS53ZWIxCzAJ
BgNVBAYTAkFSMQ8wDQYDVQQDDAZjYS53ZWIwggEiMA0GCSqGSIb3DQEBAQUAA4IB
DwAwggEKAoIBAQC4NdWAz2+QJYONAnHKYpnAX2UUvgAcSkJITkSAimC4/t3aGLPJ
ydh5/CPEH+27z+QqHhEa08LWGolX14BxecoQQURBAIid0tKjFtn9S+7j5A2CaiGh
aEN77y5f78F+84a3oVitoDJO7eVCKUdmxz9RiQpUuZMQwBVFVTMsq1oyojpRwyvw
mgs8tZsln6AUQqGp0U1Co6NXVUXPcNXoAJHFJtNJz5qc9Q9xuGEZT3Zy+yo9vyWm
2Jd1iG3pOh0YSq5mFREaLmRBO58S2hZw6E+McTuvcamzkedMAOm21U5k1rcfQZ/E
NhzprfOHtY/HSv4JYgoHiNVSa25fSDOH4pQpAgMBAAGgggFeMBoGCisGAQQBgjcN
AgMxDBYKNi4zLjk2MDAuMjA4BgkrBgEEAYI3FRQxKzApAgEFDA5BQzAyLkdBRy5M
T0NBTAwLR0FHXG1iZXJuYWwMB01NQy5FWEUwcgYKKwYBBAGCNw0CAjFkMGICAQEe
WgBNAGkAYwByAG8AcwBvAGYAdAAgAFIAUwBBACAAUwBDAGgAYQBuAG4AZQBsACAA
QwByAHkAcAB0AG8AZwByAGEAcABoAGkAYwAgAFAAcgBvAHYAaQBkAGUAcgMBADCB
kQYJKoZIhvcNAQkOMYGDMIGAMCEGCSsGAQQBgjcUAgQUHhIAVwBlAGIAUwBlAHIA
dgBlAHIwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDgYDVR0PAQH/BAQDAgWgMBcGA1Ud
EQQQMA6CBmNhLndlYocErAAAqjAdBgNVHQ4EFgQUEse8kGzuuv1VPtsakJosk38r
cNswDQYJKoZIhvcNAQEFBQADggEBAC42Q64r6/8GKBBZk8+/wNqWKJD8v05oB2Ut
QnCroeaTrd18uMJ1k/E6VcHsP38Ba8ZhRgIobQZ4xTdo4btyREJNk2T8b1uVsjky
VXYgGPMbrpD4olAgNgufZaS/C9PNGqiOw/RtDlyF9J7z51TlvXpIINCIjQ3mBnf0
b1u2vqN3yqIqfBkizJmrkB722d5YRRkcJYW3U1uyyav7mL0zSzvngs4jzqL6ilEp
xZUpDFr+DB64TgqD5xmMFmf8d7iRqB50NjwVX3pwI2dQ9vsLjyCpNo7AuRWaNh3j
pMb99O9iqeuenphaX15eG2HwUfVr+WncBW8/5uqQt6yFlR4ZjHA=
-----END NEW CERTIFICATE REQUEST-----
13 changes: 13 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
image="maurobernal/ca"
id=$(date +'%Y%m%d%H%M')
imagename=$image:$id
echo "========== Build image:$imagename=========="
docker.exe build -t $imagename .
echo "========== Creating container image:$imagename=========="
docker.exe run -p8443:443 -p8080:80 -d $imagename


#docker.exe push $imagename
#echo "========== Deploy image:$imagename=========="

70 changes: 35 additions & 35 deletions src/Web/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:61846",
"sslPort": 44312
}
},
"profiles": {
"Web.Devel": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Web.Produ": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
{
"profiles": {
"Web.Devel": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
},
"Web.Produ": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
},
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:61846",
"sslPort": 44312
}
}
}
4 changes: 4 additions & 0 deletions src/Web/Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" />
<PackageReference Include="NSwag.AspNetCore" />
<PackageReference Include="NSwag.MSBuild">
<PrivateAssets>all</PrivateAssets>
Expand All @@ -34,6 +35,9 @@
<!-- Auto-generated Open API specification and Angular TypeScript clients -->
<PropertyGroup>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<UserSecretsId>9bc47cec-3610-406c-9bbe-1a81008c1f7a</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>

<Target Name="NSwag" AfterTargets="PostBuildEvent" Condition=" '$(Configuration)' == 'Debug' And '$(SkipNSwag)' != 'True' ">
Expand Down

0 comments on commit 818acfa

Please sign in to comment.