最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Nginx in Docker container serving default page instead of angular app - Stack Overflow

programmeradmin0浏览0评论

I'm trying to deploy an Angular application using Docker and Nginx. I have a Dockerfile that builds the Angular app and then copies it to an Nginx image. However, when I run the container, I only see the default Nginx welcome page instead of my app.

Here's my dockerfile:

FROM node:18-alpine AS build

WORKDIR /app

COPY package*.json ./

RUN npm install

RUN npx ngcc --properties es2023 browser module main --first-only --create-ivy-entry-points

COPY . .

RUN npm run build

FROM nginx:stable

COPY nginx.conf /etc/nginx/conf.d/default.conf

COPY --from=build /app/dist/portfolio-client/ /usr/share/nginx/html

COPY nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 80


docker-compose.yml:

services:
  portfolioclientapp:
    container_name: angular-docker
    build: .
    image: portfolioclientapp:v1
    ports:
      - 80:80
    expose:
      - 80
    networks:
      - internalnet

networks:
  internalnet:
    driver: bridge

Docker logs:

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2025/01/30 21:43:27 [notice] 1#1: using the "epoll" event method
2025/01/30 21:43:27 [notice] 1#1: nginx/1.26.2
2025/01/30 21:43:27 [notice] 1#1: built by gcc 12.2.0 (Debian 12.2.0-14)
2025/01/30 21:43:27 [notice] 1#1: OS: Linux 5.15.153.1-microsoft-standard-WSL2
2025/01/30 21:43:27 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2025/01/30 21:43:27 [notice] 1#1: start worker processes
发布评论

评论列表(0)

  1. 暂无评论