Skip to content

Commit

Permalink
add docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
olmobrutall committed Feb 13, 2020
1 parent 903d1ac commit 6045812
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .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
60 changes: 60 additions & 0 deletions Southwind.React/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#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/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src

## RUN apt-get update
RUN apt-get -y install curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_13.x | bash -
RUN apt-get -y install nodejs
RUN npm install -g yarn

COPY ["Framework/Signum.Utilities/Signum.Utilities.csproj", "Framework/Signum.Utilities/"]
COPY ["Framework/Signum.Entities/Signum.Entities.csproj", "Framework/Signum.Entities/"]
COPY ["Framework/Signum.Engine/Signum.Engine.csproj", "Framework/Signum.Engine/"]
COPY ["Framework/Signum.React/Signum.React.csproj", "Framework/Signum.React/"]
COPY ["Framework/Signum.React/package.json", "Framework/Signum.React/"]
COPY ["Framework/Signum.React/yarn.lock", "Framework/Signum.React/"]


COPY ["Extensions/Signum.Entities.Extensions/Signum.Entities.Extensions.csproj", "Extensions/Signum.Entities.Extensions/"]
COPY ["Extensions/Signum.Engine.Extensions/Signum.Engine.Extensions.csproj", "Extensions/Signum.Engine.Extensions/"]
COPY ["Extensions/Signum.Engine.MachineLearning.CNTK/Signum.Engine.MachineLearning.CNTK.csproj", "Extensions/Signum.Engine.MachineLearning.CNTK/"]
COPY ["Extensions/Signum.React.Extensions/Signum.React.Extensions.csproj", "Extensions/Signum.React.Extensions/"]
COPY ["Extensions/Signum.React.Extensions/package.json", "Extensions/Signum.React.Extensions/"]
COPY ["Extensions/Signum.React.Extensions/yarn.lock", "Extensions/Signum.React.Extensions/"]

COPY ["Southwind.Entities/Southwind.Entities.csproj", "Southwind.Entities/"]
COPY ["Southwind.Logic/Southwind.Logic.csproj", "Southwind.Logic/"]
COPY ["Southwind.React/Southwind.React.csproj", "Southwind.React/"]
COPY ["Southwind.React/package.json", "Southwind.React/"]
COPY ["Southwind.React/yarn.lock", "Southwind.React/"]

WORKDIR "/src/Framework/Signum.React"
RUN yarn install

WORKDIR "/src/Extensions/Signum.React.Extensions"
RUN yarn install

WORKDIR "/src/Southwind.React"
RUN yarn install

WORKDIR /src
RUN dotnet restore "Southwind.React/Southwind.React.csproj"

COPY . .
WORKDIR "/src/Southwind.React"
RUN dotnet build "Southwind.React.csproj" -c Release # -o /app/build
RUN yarn run build

FROM build AS publish
RUN dotnet publish "Southwind.React.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Southwind.React.dll"]
8 changes: 7 additions & 1 deletion Southwind.React/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
"commandName": "IIS",
"launchBrowser": true,
"ancmHostingModel": "InProcess"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true
}
}
}
}
2 changes: 2 additions & 0 deletions Southwind.React/Southwind.React.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<UserSecretsId>Southwind</UserSecretsId>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591;NU1605</NoWarn>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand Down Expand Up @@ -55,6 +56,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.10" />
<PackageReference Include="Signum.Analyzer" Version="2.5.0" />
<PackageReference Include="Signum.TSGenerator" Version="3.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0" />
Expand Down

0 comments on commit 6045812

Please sign in to comment.