So, I've taken over a rather big angular project a while ago, and I still haven't fully grapsed all of it. I develop locally. When I have a new version ready, I push the repo to Gitlab and there, it is automatically deployed inside a Docker container that runs in a kubernetes network.
When I test locally, I use ng serve, which works nicely, because I can see live changes.
I've had a look at some of the project files and wonder if they make sense:
The Dockerfile looks like this:
# build app
COPY . /app
RUN npm run build:prod
# serve app
CMD npm start
In package.json, there are the following scripts:
"start": "ng serve",
"build:prod": "ng build --output-hashing none --configuration production && node build-elements.js",
So, that means when the docker container is set up, it first runs ng build, then node build-elements.jsand then ng serve, doesn't it? I thought, ng serve was more for the development environment?
In angular.json, there is this entry under "architects":
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "simplecomp:build",
"proxyConfig": "src/proxy.conf.json"
},
"configurations": {
"production": {
"browserTarget": "simplecomp:build:production"
}
}
},
This defines what is done when ng serve is called, am I right?
Does all of that make sense? I have the feeling that calling ng serve in the Dockerfile isn't the right way to do it. What would be better?
Thx