Why is my angular app not working in docker?

Discussão em 'Angular' iniciado por Hey L1nk, Maio 21, 2025.

  1. Hey L1nk

    Hey L1nk Guest

    I developed an app in angular 18, is a simple admin app SPA, I search into different questions and forums about this topic and could not find a way to make this work.

    So, let me show you my Dockerfile

    #1
    COPY package*.json ./

    RUN npm install --legacy-peer-deps

    COPY . .

    RUN npm run build -- --configuration production

    # 2
    FROM nginx:alpine

    COPY nginx.conf /etc/nginx/conf.d
    COPY --from=build /app/dist/app-admin /usr/share/nginx/html

    EXPOSE 80


    And also I find out you need a nginx.conf file so, this is how it looks like

    server {
    listen 80;
    listen [::]:80;
    server_name localhost;

    location / {
    root /usr/share/nginx/html;
    index index.html;
    try_files $uri /index.html;
    }

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root /usr/share/nginx/html;
    }
    }


    I try to change it manually but is not the right way, this only show me a screen that says: "Welcome to nginx!"

    So what I'm doing wrong? It builds with no error but also showing nothing on logs

    Continue reading...

Compartilhe esta Página