Files
myoffice_public/Docker/Dockerfile.api
T

40 lines
1.6 KiB
Docker

# MyOffice API (Kestrel :8080) — build from repo root:
# docker build -f Docker/Dockerfile.api -t myoffice-api .
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY MyOffice.sln ./
COPY MyOffice.Core/MyOffice.Core.csproj MyOffice.Core/
COPY MyOffice.Shared/MyOffice.Shared.csproj MyOffice.Shared/
COPY MyOffice.Data.Models/MyOffice.Data.Models.csproj MyOffice.Data.Models/
COPY MyOffice.DbContext/MyOffice.DbContext.csproj MyOffice.DbContext/
COPY MyOffice.Data.Repositories/MyOffice.Data.Repositories.csproj MyOffice.Data.Repositories/
COPY MyOffice.Services/MyOffice.Services.csproj MyOffice.Services/
COPY MyOffice.Migration.Sqlite/MyOffice.Migrations.Sqlite.csproj MyOffice.Migration.Sqlite/
COPY MyOffice.Migration.Postgres/MyOffice.Migrations.Postgres.csproj MyOffice.Migration.Postgres/
COPY MyOffice.Web/MyOffice.Web.csproj MyOffice.Web/
RUN dotnet restore MyOffice.Web/MyOffice.Web.csproj
COPY MyOffice.Core/ MyOffice.Core/
COPY MyOffice.Shared/ MyOffice.Shared/
COPY MyOffice.Data.Models/ MyOffice.Data.Models/
COPY MyOffice.DbContext/ MyOffice.DbContext/
COPY MyOffice.Data.Repositories/ MyOffice.Data.Repositories/
COPY MyOffice.Services/ MyOffice.Services/
COPY MyOffice.Migration.Sqlite/ MyOffice.Migration.Sqlite/
COPY MyOffice.Migration.Postgres/ MyOffice.Migration.Postgres/
COPY MyOffice.Web/ MyOffice.Web/
RUN dotnet publish MyOffice.Web/MyOffice.Web.csproj -c Release -o /app/publish --no-restore
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final
WORKDIR /app
COPY --from=build /app/publish .
ENV ASPNETCORE_ENVIRONMENT=Docker
ENV ASPNETCORE_URLS=http://+:8080
EXPOSE 8080
ENTRYPOINT ["dotnet", "MyOffice.Web.dll"]