30 lines
1.4 KiB
Docker
30 lines
1.4 KiB
Docker
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
|
|
|
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
|
|
WORKDIR /app
|
|
EXPOSE 80
|
|
|
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
|
WORKDIR /src
|
|
COPY ["DamageAssesment.Api.Documents/DamageAssesment.Api.DocuLinks.csproj", "DamageAssesment.Api.Documents/"]
|
|
RUN dotnet restore "DamageAssesment.Api.Documents/DamageAssesment.Api.DocuLinks.csproj"
|
|
COPY . .
|
|
WORKDIR "/src/DamageAssesment.Api.Documents"
|
|
RUN dotnet build "DamageAssesment.Api.DocuLinks.csproj" -c Release -o /app/build
|
|
|
|
FROM build AS publish
|
|
RUN dotnet publish "DamageAssesment.Api.DocuLinks.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
|
|
|
FROM base AS final
|
|
WORKDIR /app
|
|
COPY --from=publish /app/publish .
|
|
# Create directories for attachments and set permissions
|
|
RUN mkdir -p /app/DASA_Documents/Active && \
|
|
mkdir -p /app/DASA_Documents/Deleted && \
|
|
chown -R www-data:www-data /app/DASA_Documents
|
|
|
|
# Update appsettings.json with the correct paths for attachments
|
|
RUN sed -i 's#"folderpath": "DASA_Documents/Active"#"folderpath": "/app/DASA_Documents/Active"#' appsettings.json && \
|
|
sed -i 's#"Deletepath": "DASA_Documents/Deleted"#"Deletepath": "/app/DASA_Documents/Deleted"#' appsettings.json
|
|
|
|
ENTRYPOINT ["dotnet", "DamageAssesment.Api.DocuLinks.dll"] |