Sujet :

Failed to load resource: the server responded with a status of 404 (Not Found)

Liste des sujets Répondre Créer un sujet

Daniogo

Membre depuis le 19/09/2023

Bonjour à tous ,je suis débutante en devops et là j'essaie de dockeriser mon application angular dotnet avec une base sqlserver,mais je rencontre des difficulté,lorsque je lance le conteneur j'obtiens l'erreur que j'ai mis en titre.

quelqu'un pourrait m'aider à comprendre.

initproject\Angular\init-project\Dockerfile
#Stage 1
FROM node:alpine as build
RUN mkdir -p /app
WORKDIR /app
RUN npm install -g @angular/cli
COPY ./package.json .
COPY ./package-lock.json .
RUN npm install
COPY . .
RUN npm run build

#Stage 2
FROM nginx as runtime
COPY --from=build /app/dist/init-project /usr/share/nginx/html
EXPOSE 80
# Démarrer le serveur Nginx lorsque le conteneur démarre
CMD ["nginx", "-g", "daemon off;"]

***initproject\InitProject\Dockerfile***
#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 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["InitProject/InitProject.csproj", "InitProject/"]
COPY ["DataLayer/DataLayer.csproj", "DataLayer/"]
COPY ["ServiceLayer/ServiceLayer.csproj", "ServiceLayer/"]
RUN dotnet restore "InitProject/InitProject.csproj"
COPY . .
WORKDIR "/src/InitProject"
RUN dotnet build "InitProject.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "InitProject.csproj" -c Release -o /app/publish /p:UseAppHost=false

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

****initproject\docker-compose.yml****
version: '3.4'
networks:
  network:
    driver: bridge

services:
  db:
    container_name: sql-server
    build: 
      context: ./db
      dockerfile: db.Dockerfile
    volumes:
       - My_mssqlsystem:/var/lib/docker/volumes/mssqlsystem/_data
       - My_mssqlsystem:/var/lib/docker/volumes/mssqluser/_data
       - ./initproject.sql:/docker-entrypoint-initdb.d/initproject.sql
    environment:
      - ACCEPT_EULA=Y
      - SA_PASSWORD=ku257dgTJUy00s
      - MSSQL_PID=Express
      - MSSQL_TCP_PORT=1433
    ports:
      - "1433:1433"
    networks:
      - network
    restart: always
    
  initproject:
    container_name: Api-container
    image: ${DOCKER_REGISTRY-}initproject
    build:
      context: .
      dockerfile: InitProject/Dockerfile
    networks:
    - network
    ports:
      - "7290:443"
    depends_on:
      - db

  angular-app:
    container_name: web-container
    build: 
      context: ./Angular/init-project
      dockerfile: Dockerfile
    ports:
      - "4200:80"
    depends_on:
      - initproject
      - db
    networks:
      - network
volumes:
  My_mssqlsystem:
    
  

  



Répondre

vous devez être connecté pour poster un message !

Rejoindre la communauté

Recevoir les derniers articles gratuitement en créant un compte !

S'inscrire