How do i use Angular CLI inside a dockerized app?

Discussão em 'Angular' iniciado por morgred, Setembro 25, 2024.

  1. morgred

    morgred Guest

    Is there a way to use CLI commands when developing on dockerized instances i connect remotely to?

    I work with a monolith and connect to the codebase remotely, where i run docker instances for our frontends.

    Right now Imade a local build with newest angular, because we intend to upgrade incrementally and we want to introduce this version and develop new features on it as well as migrate old features on it over time.

    I want to use Angular CLI to generate the boilerplate for the new components, but I am not sure how to use it in this setup, builds networks and backend are not my strengths.

    This is how i setup [ Dockerfile ]

    FROM node:18.20-alpine
    WORKDIR /app
    COPY package.json .

    RUN npm install -g @angular/cli
    RUN npm install

    COPY . .
    EXPOSE 4200 49153

    CMD npm run start
    CMD ['ng']


    [ compose.yaml ]

    services:
    docker-beta-3:
    build: .
    ports:
    - 4200:4200
    - 49153:49153
    volumes:
    - "/app/node_modules"
    - ".:/app"


    I've tried using this to access the shell and run my "ng generate component comp1" there, but it doesn't recognize the "ng"

    I can run the command when being in the right folder, but that's just what I have installed locally and I get that

    docker exec -it 0bd974419cae sh

    Continue reading...

Compartilhe esta Página