Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Biagio Paruolo 1618 posts 1910 karma points c-trib
    Aug 03, 2024 @ 15:46
    Biagio Paruolo
    0

    Sharing the Docker Files and compose to run Umbraco 13+ into a Linux container with SSL

    Hi,

    I share with the community my docker file and docker compose to run Umbraco 13. Sure it can be tweaked, but it works.

    Dockerfile:

    FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy AS base USER root
    # Install cultures (same approach as Alpine SDK image) for ALPINE
    # RUN apk add --no-cache icu-libs icu-data-full
    #ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=0 ENV DOTNET_RUNNING_IN_CONTAINER=true RUN apt-get update && apt-get install
    -y libicu-dev         WORKDIR /app EXPOSE 8080 EXPOSE 8081
        FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["AgriPass360/AgriPass360.csproj", "AgriPass360/"] COPY ["AgriPass360Lib/AgriPass360Lib.csproj", "AgriPass360Lib/"] COPY ["AgriPass360PraticaModels/AgriPass360PraticaModels.csproj", "AgriPass360PraticaModels/"] RUN dotnet restore "AgriPass360/AgriPass360.csproj" COPY . . WORKDIR "/src/AgriPass360" RUN dotnet build "AgriPass360.csproj" -c $BUILD_CONFIGURATION -o /app/build
    
    FROM build AS publish ARG BUILD_CONFIGURATION=Release RUN dotnet publish "AgriPass360.csproj" -c $BUILD_CONFIGURATION -o /app/publish
    
    FROM base AS final
    #ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=0 RUN apt-get install -y libicu-dev
    
    WORKDIR /app COPY --from=publish /app/publish . USER root RUN mkdir -p /app/umbraco/Data/TEMP RUN mkdir -p /app/umbraco/Data/TEMP/FileUploads RUN chown -R $APP_UID:$APP_UID /app RUN chmod o=rw /app/wwwroot/ RUN chmod o=rw /app/Views/ USER $APP_UID ENTRYPOINT ["dotnet", "AgriPass360.dll"]
    

    docker-compose:

    services:
      agripass360:
        image: agripass360
        build:
          context: .
          dockerfile: AgriPass360/Dockerfile
        restart: always
        ports:
              - 48638:8080
              - 44380:8081
        environment:
           - ASPNETCORE_ENVIRONMENT=Development
           - ASPNETCORE_Kestrel__Certificates__Default__Password=DHDHDHDHD2024
           - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx
           - ASPNETCORE_HTTPS_PORTS=8081
           - ASPNETCORE_URLS=https://+:8081;http://+:8080
        volumes:
              - ${HOME}/.aspnet/https:/https:ro
              - umbraco_data:/app/umbraco/Data
              - umbraco_data_temp:/app/umbraco/Data/TEMP
              - umbraco_media:/app/wwwroot/media
              - umbraco_documents:/app/wwwroot/DocumentiElaborati
              - umbraco_models:/app/wwwroot/FileModel
    volumes:
      umbraco_data:
      umbraco_data_temp:
      umbraco_media:
      umbraco_documents:
      umbraco_models:
    
  • Hüseyin 13 posts 103 karma points
    Sep 08, 2024 @ 19:56
    Hüseyin
    0

    Hi Biagio,

    I use the same structure—a Linux server with a docker application. But I couldn't figure out how to enable rewrite rules in web config. I thought I was going to install iis rewrite module but the scripts are not working This is my dockerfile:

    FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
    USER $APP_UID
    WORKDIR /app
    EXPOSE 8080
    
    FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
    ARG BUILD_CONFIGURATION=Release
    WORKDIR /src
    
    COPY ["Umbraco.Web/Umbraco.Web.csproj", "Umbraco.Web/"]
    RUN dotnet restore "Umbraco.Web/Umbraco.Web.csproj"
    
    COPY . .
    WORKDIR "/src/Umbraco.Web"
    RUN dotnet build "Umbraco.Web.csproj" -c "$BUILD_CONFIGURATION" -o /app/build
    
    FROM build AS publish
    ARG BUILD_CONFIGURATION=Release
    RUN dotnet publish "Umbraco.Web.csproj" -c "$BUILD_CONFIGURATION" -o /app/publish /p:UseAppHost=false
    
    FROM base AS final
    WORKDIR /app
    COPY --from=publish /app/publish .
    
    ENTRYPOINT ["dotnet", "Umbraco.Web.dll"]
    
  • Biagio Paruolo 1618 posts 1910 karma points c-trib
    Sep 09, 2024 @ 07:09
    Biagio Paruolo
    0

    Hi, the web.config is used by IIS and not under Linux. You have to check the container config file for the ingress rules: https://kubernetes.github.io/ingress-nginx/examples/rewrite/.

Please Sign in or register to post replies

Write your reply to:

Draft