45 lines
1.7 KiB
Docker
45 lines
1.7 KiB
Docker
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
|
USER app
|
|
WORKDIR /app
|
|
EXPOSE 8070
|
|
EXPOSE 8071
|
|
|
|
# gerekli olan 'libgdiplus' paketini yükle
|
|
USER root
|
|
RUN apt-get update && apt-get install -y libgdiplus openssl
|
|
|
|
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
|
ARG BUILD_CONFIGURATION=Release
|
|
WORKDIR /src
|
|
COPY ["ConstructorAppUI/ConstructorAppUI.csproj", "ConstructorAppUI/"]
|
|
COPY ["ConstructorApp.DataAccessLayer/ConstructorApp.DataAccessLayer.csproj", "ConstructorApp.DataAccessLayer/"]
|
|
COPY ["ConstructorApp.EntityLayer/ConstructorApp.EntityLayer.csproj", "ConstructorApp.EntityLayer/"]
|
|
COPY ["ConstructorApp.DtoLayer/ConstructorApp.DtoLayer.csproj", "ConstructorApp.DtoLayer/"]
|
|
RUN dotnet restore "./ConstructorAppUI/ConstructorAppUI.csproj"
|
|
COPY . .
|
|
WORKDIR "/src/ConstructorAppUI"
|
|
RUN dotnet build "./ConstructorAppUI.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
|
|
|
|
|
FROM build AS publish
|
|
ARG BUILD_CONFIGURATION=Release
|
|
RUN dotnet publish "./ConstructorAppUI.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y openssl
|
|
|
|
# Create directories for the certificate
|
|
RUN mkdir -p /app/publish/https
|
|
|
|
# Generate a self-signed certificate
|
|
RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /app/publish/https/aspnetapp.key -out /app/publish/https/aspnetapp.crt -subj "/CN=localhost"
|
|
RUN openssl pkcs12 -export -out /app/publish/https/aspnetapp.pfx -inkey /app/publish/https/aspnetapp.key -in /app/publish/https/aspnetapp.crt -passout pass:itRkTNSFBEFPqCGdYEuIloyhx
|
|
|
|
|
|
FROM base AS final
|
|
USER root
|
|
WORKDIR /app
|
|
COPY --from=publish /app/publish .
|
|
RUN chmod -R 777 /app/https
|
|
ENTRYPOINT ["dotnet", "ConstructorAppUI.dll"] |