2024-11-12 19:57:44 +04:00
|
|
|
|
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
EXPOSE 5124
|
|
|
|
|
|
|
|
|
|
ENV ASPNETCORE_URLS=http://+:5124
|
|
|
|
|
|
|
|
|
|
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
|
|
|
|
|
# For more info, please refer to https://aka.ms/vscode-docker-dotnet-configure-containers
|
|
|
|
|
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
|
|
|
|
|
USER appuser
|
|
|
|
|
|
2024-11-13 01:49:13 +04:00
|
|
|
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
2024-11-12 19:57:44 +04:00
|
|
|
|
ARG configuration=Release
|
|
|
|
|
WORKDIR /src
|
2024-11-13 01:49:13 +04:00
|
|
|
|
COPY ["Cloud.csproj", "."]
|
|
|
|
|
RUN dotnet restore "./Cloud.csproj"
|
2024-11-12 19:57:44 +04:00
|
|
|
|
COPY . .
|
2024-11-13 01:49:13 +04:00
|
|
|
|
WORKDIR "/src/."
|
|
|
|
|
RUN dotnet build "./Cloud.csproj" -c $configuration -o /app/build
|
2024-11-12 19:57:44 +04:00
|
|
|
|
|
|
|
|
|
FROM build AS publish
|
|
|
|
|
ARG configuration=Release
|
2024-11-13 01:49:13 +04:00
|
|
|
|
RUN dotnet publish "./Cloud.csproj" -c $configuration -o /app/publish /p:UseAppHost=false
|
2024-11-12 19:57:44 +04:00
|
|
|
|
|
|
|
|
|
FROM base AS final
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
COPY --from=publish /app/publish .
|
2024-11-13 03:33:49 +04:00
|
|
|
|
# TODO: Добавить инициализацию базы данных с помощью миграции
|
2024-11-12 19:57:44 +04:00
|
|
|
|
ENTRYPOINT ["dotnet", "Cloud.dll"]
|
2024-11-13 01:49:13 +04:00
|
|
|
|
|