admin管理员组文章数量:1296917
I'm relatively new docker so I'm pretty sure I'm not doing something right. I have a Angular application, with .Net as the back end api. It works fine when I run it using Visual Studio, however it fails when I run it in docker.
Here is my docker file:
# Stage 1: Build the Angular application
FROM node:12.22.12 AS build_node
WORKDIR /frontend
copy . .
RUN npm cache clean --force
RUN rm -rf node_modules
RUN rm package-lock.json
RUN npm install
EXPOSE 4200
CMD ["npm", "start"]
# This stage is used when running from VS in fast mode (Default for Debug configuration)
FROM mcr.microsoft/dotnet/aspnet:8.0-noble AS base
USER $APP_UID
WORKDIR /app
# This stage is used to build the service project
FROM mcr.microsoft/dotnet/sdk:8.0-noble AS build
ARG BUILD_CONFIGURATION=development
WORKDIR /src
COPY ["ProjectName.csproj", "."]
RUN dotnet restore "./ProjectName.csproj"
COPY . ./
Expose 5000
Expose 5001
CMD ["dotnet", "watch", "run"]
here is my docker-compose.yml
file
version: '3.8'
services:
angular:
build:
context: .
dockerfile: Dockerfile
target: build_node
ports:
- "4200:4200"
dotnet:
build:
context: .
dockerfile: Dockerfile
target: build
ports:
- "5000:5000"
- "5001:5001"
depends_on:
- angular
In my terminal when I run: docker-compose up --build
there are no errors, and I get the following output:
[+] Running 2/2
✔ Container cbas-angular-1 Recreated 0.1s
✔ Container cbas-dotnet-1 Recreated 0.1s
Attaching to angular-1, dotnet-1
angular-1 |
angular-1 | > [email protected] start /frontend
angular-1 | > ng serve --aot --proxy-config proxy.config.js --hmr -e=hmr
angular-1 |
dotnet-1 | dotnet watch ⌚ Polling file watcher is enabled
dotnet-1 | dotnet watch
本文标签:
angularUnable to access web application after containerizationStack Overflow
版权声明:本文标题:angular - Unable to access web application after containerization - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人,
转载请联系作者并注明出处:http://www.betaflare.com/web/1741640894a2389910.html,
本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论