I'm the totalest noob to Docker (while rather comfy with the rest of tech stack). Following roughly the Docker guide, I've landed in the following Dockerfile.
FROM angular/ngcontainer:latest
WORKDIR /ClientApp
COPY . .
RUN npm install --global @angular/cli
RUN npm install
CMD ["ng", "serve"]
I've checked and tried to understand all the best practices for Dockerfile design. Then, I created my images and started it like this (relying on the pre-existing image angular/ngcontainer).
docker build --tag ng-poc .
dock run --detach --publish 4343:4200 --name NgPocky --interactive ng-poc
It fails giving me the error log below. What I gather from it is that the ng command isn't found. When I tried the global add on my machine, it worked, so I suspect that it might be an error due to my lack of understanding how global the command becomes in a Linux environment (and/or errors in the Dockerfile itself, of course).
/home/circleci/.npm-global/bin/ng: line 2: use strict: command not found
/home/circleci/.npm-global/bin/ng: line 4: //: Is a directory
/home/circleci/.npm-global/bin/ng: line 5: //: Is a directory
/home/circleci/.npm-global/bin/ng: line 6: try: command not found
/home/circleci/.npm-global/bin/ng: ng: line 7: syntax error near unexpected token `('
/home/circleci/.npm-global/bin/ng: ng: line 7: ` process.title = 'ng ' + Array.from(process.argv).slice(2).join(' ');'
Not sure how to troubleshoot it further at this point.
sysprepSO). With this in mind, I suggest you to start (read: FROM) an ubuntu image. On DockerHub you find prepared images: you must read the CONTENT of the image on description or better if the image has a GitHub repo where you can look at the Dockerfile and understand which contains.FROM node, compile the project producing the executable artifacts and thenFROM nginxto serve them? Or is it generally a less painful approach to go with vanilla Ubuntu, install NodeJs on it and do all the magic there? I'm fine with opinionated input too. :)COPY --from