mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
build(directory): 🔨 apply misc docker build work
This commit is contained in:
parent
6745cffbfc
commit
bc3d4da9eb
10 changed files with 44 additions and 30 deletions
|
|
@ -1,22 +1,36 @@
|
|||
#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-alpine AS base
|
||||
# init base
|
||||
FROM mcr.microsoft.com/dotnet/core/runtime-deps:3.1-alpine AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
ENTRYPOINT ./FilterLists.Directory.Api
|
||||
|
||||
# init build
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS build
|
||||
|
||||
# restore
|
||||
WORKDIR /src
|
||||
COPY ["directory/src/FilterLists.Directory.Api/FilterLists.Directory.Api.csproj", "directory/src/FilterLists.Directory.Api/"]
|
||||
RUN dotnet restore "directory/src/FilterLists.Directory.Api/FilterLists.Directory.Api.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/directory/src/FilterLists.Directory.Api"
|
||||
RUN dotnet build "FilterLists.Directory.Api.csproj" -c Release -o /app/build
|
||||
COPY src/FilterLists.Directory.Domain/FilterLists.Directory.Domain.csproj FilterLists.Directory.Domain/
|
||||
COPY src/FilterLists.Directory.Application/FilterLists.Directory.Application.csproj FilterLists.Directory.Application/
|
||||
COPY src/FilterLists.Directory.Infrastructure.Migrations/FilterLists.Directory.Infrastructure.Migrations.csproj FilterLists.Directory.Infrastructure.Migrations/
|
||||
COPY src/FilterLists.Directory.Infrastructure/FilterLists.Directory.Infrastructure.csproj FilterLists.Directory.Infrastructure/
|
||||
WORKDIR /src/FilterLists.Directory.Api
|
||||
COPY src/FilterLists.Directory.Api/FilterLists.Directory.Api.csproj .
|
||||
RUN dotnet restore
|
||||
|
||||
# build
|
||||
WORKDIR /src
|
||||
COPY src/FilterLists.Directory.Domain/. FilterLists.Directory.Domain/
|
||||
COPY src/FilterLists.Directory.Application/. FilterLists.Directory.Application/
|
||||
COPY src/FilterLists.Directory.Infrastructure.Migrations/. FilterLists.Directory.Infrastructure.Migrations/
|
||||
COPY src/FilterLists.Directory.Infrastructure/. FilterLists.Directory.Infrastructure/
|
||||
WORKDIR /src/FilterLists.Directory.Api
|
||||
COPY src/FilterLists.Directory.Api/. .
|
||||
RUN dotnet build --no-restore -c Release
|
||||
|
||||
# publish
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "FilterLists.Directory.Api.csproj" -c Release -o /app/publish
|
||||
RUN dotnet publish --no-build -c Release -o /app/publish -r linux-musl-x64 -p:PublishSingleFile=true
|
||||
|
||||
# package final
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "FilterLists.Directory.Api.dll"]
|
||||
COPY --from=publish /app/publish .
|
||||
|
|
@ -6,12 +6,7 @@
|
|||
<Nullable>enable</Nullable>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<RuntimeIdentifier>linux-musl-x64</RuntimeIdentifier>
|
||||
<UserSecretsId>9bfe2a36-880e-4da0-994f-a9641e228ba3</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||
<DockerfileContext>..\..\..</DockerfileContext>
|
||||
<RuntimeIdentifiers>linux-musl-x64;win10-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@
|
|||
"commandName": "Docker",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/lists",
|
||||
"publishAllPorts": true,
|
||||
"useSSL": true
|
||||
"publishAllPorts": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
{}
|
||||
4
directory/src/FilterLists.Directory.Api/debug.Dockerfile
Normal file
4
directory/src/FilterLists.Directory.Api/debug.Dockerfile
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# init base for Visual Studio debugging
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FilterLists.Directory.Domain\FilterLists.Directory.Domain.csproj" />
|
||||
<ProjectReference Include="..\FilterLists.Directory.Infrastructure\FilterLists.Directory.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -18,4 +18,8 @@
|
|||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FilterLists.Directory.Domain\FilterLists.Directory.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -2,12 +2,10 @@ version: '3.8'
|
|||
|
||||
services:
|
||||
filterlists.directory.api:
|
||||
build:
|
||||
dockerfile: src/FilterLists.Directory.Api/debug.Dockerfile
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Development
|
||||
- ASPNETCORE_URLS=https://+:443;http://+:80
|
||||
- ASPNETCORE_URLS=http://+:80
|
||||
ports:
|
||||
- "80"
|
||||
- "443"
|
||||
volumes:
|
||||
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
|
||||
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
|
||||
- "80"
|
||||
|
|
@ -4,8 +4,8 @@ services:
|
|||
filterlists.directory.api:
|
||||
image: ${DOCKER_REGISTRY-}filterlistsdirectoryapi
|
||||
build:
|
||||
context: .
|
||||
dockerfile: directory/src/FilterLists.Directory.Api/Dockerfile
|
||||
context: ./directory
|
||||
dockerfile: src/FilterLists.Directory.Api/Dockerfile
|
||||
depends_on:
|
||||
- filterlists.directory.db
|
||||
environment:
|
||||
|
|
|
|||
Loading…
Reference in a new issue