Open Closed

Dockerize Abp web application issue #4262


User avatar
0
yim.tim created

I try to dockerize Abp web application. However, I found the following issues. Please Advise.

The following is the docker-compose.yml file where dnf is the system name.

services:
  dnf.httpapi.host:
    image: ${DOCKER_REGISTRY-}dnfhttpapihost
    container_name: dnf.httpapi.host
    ports:
      - "44326:44326"
      - "4200:4200"
      - "30080:80"
      - "30443:443"
    build:
      context: .
      dockerfile: src/DNF.HttpApi.Host/Dockerfile
    depends_on:
      - dnf.db
    restart: on-failure

  dnf.db:
    image: "mcr.microsoft.com/mssql/server"
    container_name: dnf.db
    ports:
      - "34330:1433"
    restart: always
    environment:
      MSSQL_SA_PASSWORD: "123456"
      SA_PASSWORD: "123456"
      ACCEPT_EULA: "Y"

  dnf.authserver:
    image: ${DOCKER_REGISTRY-}dnfauthserver
    container_name: dnf.authserver
    ports:
      - "44324:44324"
    build:
      context: .
      dockerfile: src/DNF.AuthServer/Dockerfile
    depends_on:
      - dnf.db
    restart: on-failure

  redis:
    image: redis
    container_name: redis
    ports:
      - '6379:6379'

13 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    It is only used for the local development environment: https://docs.abp.io/en/abp/latest/Virtual-File-System#dealing-with-embedded-files-during-development

    You can try to start the container with another environment(Production etc.).

    Or you can add an option to appsettings

    {
       "IsOnDocker": "false",
    }
    
    if (hostingEnvironment.IsDevelopment() && !Convert.ToBoolean(configuration["IsOnDocker"]))
    {
        Configure<AbpVirtualFileSystemOptions>(options =>
        {
           ......
        });
    }
    
    services:
      dnf.httpapi.host:
        image: ${DOCKER_REGISTRY-}dnfhttpapihost
        container_name: dnf.httpapi.host
        ports:
          - "44326:44326"
          - "4200:4200"
          - "30080:80"
          - "30443:443"
        build:
          context: .
          dockerfile: src/DNF.HttpApi.Host/Dockerfile
        depends_on:
          - dnf.db
        restart: on-failure
        environment:
            IsOnDocker: "true"
    
    
  • User Avatar
    0
    yim.tim created

    Docker log show that abp need to login before start authentication server. Please advise. Thx.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Could you share the full error log? thanks.

  • User Avatar
    0
    yim.tim created

    Please see the following docker console log.

  • User Avatar
    0
    yim.tim created

    I try to copy access.bin to /root but the following error display. Please kindly advise.

    The following is the Dockerfile of the auth server and VS2022 are run under debug mode. FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 COPY ["./docker-materials/access-token.bin", "/root/.abp/cli/"]

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    1

    Please make sure the AbpLicenseCode exists in your appsettings.json or appsettings.secrets.json file.

    You can create a new project to copy it.

    2

    You need to restore the NPM packages. run abp install-libs in the project folder to restore and publish the project again.

  • User Avatar
    0
    yim.tim created

    The license are existed.

    The following error are displayed when access the page.

  • User Avatar
    0
    yim.tim created

    I try to run the application without docker but the issue is same. It seems the issue no related to dockerize issue.

    I found my company network is https inspection environment. It mean all the https connection will change the SSL certificate to self-signed certificate. I execute the follow command by order but the issue still exists. Please kindly advise.

    1. npm set strict-ssl false
    2. yarn config set strict-ssl false -g
    3. abp install-libs
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    What's the content of wwwroot\libs after running the abp install-libs command?

  • User Avatar
    0
    yim.tim created

    I try to clean all the npm, clean yarn cache, delete node_package folder, delete yarn.lock file and re-run "abp install-libs".

    However, the following abp.ng.theme.lepton-x warning are found. Is this relate? warning "@volosoft/abp.ng.theme.lepton-x > @volo/abp.ng.lepton-x.core > @volo/ngx-lepton-x.core@1.0.3" has incorrect peer dependency "@angular/core@14.2.0".

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Is it possible to reproduce the problem in a new project template?

  • User Avatar
    0
    yim.tim created

    I will try to reproduce in new project later.

    Current project was fixed after I clean all the node_packe, del yarn.lock file and run "abp install-libs". I will try to dockerize continuously.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    OK

Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38