Issue
I have docker container for angular project, using node 18; Dockerfile:
FROM node:18
WORKDIR /app
COPY package*.json ./
RUN npm update
RUN npm install
COPY . .
EXPOSE 4200
CMD ["ng", "serve", "--host", "0.0.0.0", "--port", "4200"]
problem is when I run sudo docker-copmose build
, its good but then i try sudo docker-compose up
it has an errors :
auralab-angular | Node packages may not be installed. Try installing with 'npm install'. auralab-angular | Error: Could not find the '@angular-devkit/build-angular:dev-server' builder's node package. auralab-angular exited with code 1
I am using google-cloud unbutu machine, but i dont know error reason. docker-compose.yaml:
angular:
image: auralab-angular:latest
container_name: auralab-angular
build:
context: ./client
dockerfile: Dockerfile
volumes:
- ./client:/app
ports:
- "4200:4200"
command: ["ng", "serve", "--host", "0.0.0.0", "--port", "4200"]
depends_on:
- django
structure is :
project:
|___client:
|_______Dockerfile
|_______other files;
|___docker-compose.yaml
Solution
You'll need to install the Angular CLI inside your Docker container.
FROM node:18
WORKDIR /app
COPY package*.json ./
# Install Angular CLI globally
RUN npm install -g @angular/cli
RUN npm install
COPY . .
EXPOSE 4200
CMD ["ng", "serve", "--host", "0.0.0.0", "--port", "4200"]
Answered By - Ale_Bianco
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.