Dockerfile support added to webapi
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
2022-07-15 12:59:19 -04:00
parent 6a2c2a2c33
commit c32e3bc64d
4 changed files with 49 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*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

View File

@@ -0,0 +1,22 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["WebNovelPortalAPI/WebNovelPortalAPI.csproj", "WebNovelPortalAPI/"]
COPY ["DBConnection/DBConnection.csproj", "DBConnection/"]
COPY ["Shared/Shared.csproj", "Shared/"]
RUN dotnet restore "WebNovelPortalAPI/WebNovelPortalAPI.csproj"
COPY . .
WORKDIR "/src/WebNovelPortalAPI"
RUN dotnet build "WebNovelPortalAPI.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "WebNovelPortalAPI.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebNovelPortalAPI.dll"]

View File

@@ -4,6 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>

View File

@@ -6,7 +6,7 @@
}
},
"ConnectionStrings": {
"DefaultConnection": "Data Source=/home/m/Documents/WebNovelPortal/WebNovelPortalAPI/test_db"
"DefaultConnection": "Data Source=test_db"
},
"AllowedHosts": "*"
}