Docker container empty after successful build-Please help

Hi
I am fairly new to docker and i have been struggling with this for more then 10 days and i have run out of ideas
I have an aplication that needs to be containerized
The application consists three parts:
-app(Angular)
-api(DotnetCore)
Idserver(DotnetCore)
I use Gitlab for the repo and gitlab CI and a self hosted linux ruuner
I have sucsesfuli deployed the application in docker ,but the api and id server are misssing the aplication files.Only the app part is ok
The build and deploy are without errors

Here are my gitlab-ci file ,docker compose ,and Dockerfiles

Any help wolud be very appreciated ,because i am stuck, and i dont have any ideas left
Thank you
gitlab-ci.yml

stages:
  - diagnose
  - build
  - deploy
  #- test
  #- deploy


# Define variables for the Docker image name based on the branch
variables:
  SERVER_IP: "x.x.x.x"
  APP_NAME: "testapp"
  COMPOSE_FILE: "src/docker-compose.yml"
  DEPLOY_PATH: "/opt/docker-apps/${APP_NAME}"
  DOCKER_TLS_CERTDIR: ""  # Disable TLS since we're using it within GitLab CI
  DOCKER_HOST: unix:///var/run/docker.sock
  DOCKER_DRIVER: overlay2



before_script:
  - set -x  # Enable command tracing for debugging #
  - apk update 
  - apk add curl
 


diagnose:
  stage: diagnose
  image: docker:latest
  script:
    - echo "Docker version:"
    - docker --version || echo "Docker command not found"
    - echo "Docker info:"
    - docker info || echo "Unable to get Docker info"
    - echo "Contents of /var/run:"
    - ls -la /var/run || echo "Unable to list /var/run"
    - echo "Current user:"
    - id
    - echo "System information:"
    - uname -a
  allow_failure: true

build:
  stage: build
  image: docker:latest
  before_script:
    - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  script:
    - docker info
    - docker-compose build
    - docker-compose push
  only:
    - c2

 

deploy:
  stage: deploy
  image: docker:latest
  before_script:
    - apk add --no-cache openssh-client curl
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
    - chmod 644 ~/.ssh/known_hosts
    - echo "StrictHostKeyChecking no" >> ~/.ssh/config
  script:
    - |
      ssh $SERVER_USER@$SERVER_IP "
        if ! command -v docker-compose &> /dev/null; then
          sudo curl -L \"https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-\$(uname -s)-\$(uname -m)\" -o /usr/local/bin/docker-compose
          sudo chmod +x /usr/local/bin/docker-compose
        fi
        docker --version && docker-compose --version
      "
    - |
      ssh $SERVER_USER@$SERVER_IP "
        sudo mkdir -p ${DEPLOY_PATH}
        sudo chown $SERVER_USER:$SERVER_USER ${DEPLOY_PATH}
      "
    - scp ${COMPOSE_FILE} $SERVER_USER@$SERVER_IP:${DEPLOY_PATH}/docker-compose.yml
    - |
      ssh $SERVER_USER@$SERVER_IP "
        cd ${DEPLOY_PATH} &&
        echo 'CI_REGISTRY_IMAGE=${CI_REGISTRY_IMAGE}' > .env &&
        echo 'CI_COMMIT_SHA=${CI_COMMIT_SHA}' >> .env &&
        docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY} &&
        docker-compose pull &&
        docker-compose up -d
      "
  only:
    - c2
  when: manual



Docker-compose file

services:
  

  test-api:
    #image: test-api
    image: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA:-latest}
    container_name: test-api
    build:
      context: .
      dockerfile: test.Api/Dockerfile
      
    volumes:
      - ./certbot/www/:/var/www/certbot/:rw
      - ./certbot/conf/:/etc/letsencrypt/:rw
      - ./test.Api/https:/app/https:rw
     
    ports:
      - "7130:443"
      - "5130:80"
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=https://+:443;http://+80;
      - ASPNETCORE_Kestrel__Certificates__Default__Password=test
      - ASPNETCORE_Kestrel__Certificates__Default__Path=/app/https/testApiCert.pfx
    networks:
      - backend_test
      - frontend_test
    depends_on:
      - test-postgres
  test-idserver:
    #image: test-idserver
    image: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA:-latest}
    container_name: test-idserver
    build:
      context: .
      dockerfile: test.IdServer/Dockerfile
    volumes:
      - ./certbot/www/:/var/www/certbot/:rw
      - ./certbot/conf/:/etc/letsencrypt/:rw
      - ./test.IdServer/https:/app/https:ro
      
    ports:
      - "7181:443"
      - "5181:80"
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=https://+:443;http://+80;
      - ASPNETCORE_Kestrel__Certificates__Default__Password=test
      - ASPNETCORE_Kestrel__Certificates__Default__Path=/app/https/testIdServerCert.pfx
    networks:
      - backend_test
      - frontend_test
    depends_on:
      - test-postgres

  test-app:
    
    image: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA:-latest}
    container_name: test-app
    build:
      context: .
      dockerfile: test.App/Dockerfile
    ports:
      - "443:443"  # Replace with the appropriate ports if needed
      - "80:80"   # Replace with the appropriate ports if needed
    #environment:
    #  - ASPNETCORE_ENVIRONMENT=Development
    #  - ASPNETCORE_URLS=https://+:443;http://+80;
    #  - ASPNETCORE_Kestrel__Certificates__Default__Password=test
    #  - ASPNETCORE_Kestrel__Certificates__Default__Path=/app/https/testAppCert.pfx  # Update the certificate path if different
    depends_on:
       - test-postgres
     
       - certbot
    volumes:
      - ./certbot/www/:/var/www/certbot/:rw
      - ./certbot/conf/:/etc/letsencrypt/:rw
    networks:
      - backend_test
      - frontend_test   


          
  

  certbot:
    image: certbot/certbot
    container_name: certbot
    volumes:
      - ./certbot/www/:/var/www/certbot/:rw
      - ./certbot/conf/:/etc/letsencrypt/:rw
    entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 96h & wait $${!}; done;'"
    networks:
      - frontend_test   
    
  test-postgres:
    image: postgres:16
    container_name: test-postgres
    restart: always
    ports:
      - "5433:5432"
    environment:
      - POSTGRES_USER=test
      - POSTGRES_PASSWORD=test
      - POSTGRES_DB=test
    networks:
      - backend_test

networks:
  backend_test:
  frontend_test:

Docker files
Api:

1.08 KiB
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
# Install needed library for SkiaSharp font
RUN apt-get update
RUN apt-get install -y libfontconfig1
# Copy and trust certificate
COPY ["test.Api/https/testDockerRootCert.crt", "../usr/local/share/ca-certificates/"]
RUN update-ca-certificates
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Debug
WORKDIR /src
COPY ["test.Api/test.Api.csproj", "test.Api/"]
COPY ["test.Core/test.Core.csproj", "test.Core/"]
COPY ["test.Infrastructure/test.Infrastructure.csproj", "test.Infrastructure/"]
RUN dotnet restore "test.Api/test.Api.csproj"
COPY . .
WORKDIR "/src/test.Api"
RUN dotnet build "test.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Debug
RUN dotnet publish "test.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
COPY ["test.Api/https/testDockerRootCert.crt", "/app/https/"]
ENTRYPOINT ["dotnet", "test.Api.dll"]

Idserver:

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 80
EXPOSE 443

# Copy and trust root CA certificate
USER root
COPY ["test.IdServer/https/testDockerRootCert.crt", "../usr/local/share/ca-certificates/"]
RUN update-ca-certificates

USER $APP_UID
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Debug
WORKDIR /src
COPY ["test.IdServer/test.IdServer.csproj", "test.IdServer/"]
COPY ["test.Infrastructure/test.Infrastructure.csproj", "test.Infrastructure/"]
COPY ["test.Core/test.Core.csproj", "test.Core/"]
RUN dotnet restore "test.IdServer/test.IdServer.csproj"
COPY . .
WORKDIR "/src/test.IdServer"
RUN dotnet build "test.IdServer.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Debug
RUN dotnet publish "test.IdServer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "test.IdServer.dll"]

APP:

FROM node:21-alpine3.18 AS build

# Set the working directory inside the container
WORKDIR /app

# Copy necessary files for dependency installation
#COPY package.json package-lock.json angular.json
COPY ["./Test.app/package*.json" , "."]
RUN npm i swagger-typescript-api -g

# Install the Angular CLI 
RUN npm install -g @angular/cli
RUN npm install @angular-devkit/build-angular --force

# Copy the entire application to the container
#COPY . .
COPY ["./Test.app/." , "."]
#RUN npm i -s -g @angular/compiler-cli @angular/language-service @angular-devkit/build-angular
RUN npm run build



FROM nginx:latest

# Copy the NGINX configuration file to the appropriate location
COPY ["nginx.conf", "/etc/nginx/nginx.conf"]

# Copy the built Angular app from the  image to the NGINX HTML directory

COPY --from=build /app/dist/saturnapp/. /etc/nginx/html

EXPOSE 80 443 

# Specify the command to run NGINX in the foreground
CMD ["nginx", "-g", "daemon off;"]

Since there are a lot of files to check, I would not start that yet. Please, explain what do you mean by empty and what do you expect to be there and where is “there”?

Acording to the Dockerfile for API the ouput from dotnet publish comand should be in the API container in /app directory

But after a succsesful build the conatainer is strated,but when enter the container and navigate to the directory,it is empty.

Same thing for the idserver contaner

How do you start the container to test if the folder is empty? Since the compose file mounts a subfolder, app could not be empty. And Please, don’t share screenshots of texts. Sharing texts as code blocks as in your first post helps us the most. It was just too long to start to understand without more info.