What are the benefits of using an application specific Docker image vs a generic OS? I'll use an angular app here as a contextual example, but this should apply to other apps as well.
Example 1 | Use application specific images:
FROM node as build RUN npm install COPY package-lock.json RUN ng build --prod FROM nginx # ... move files from build to nginx/html EXPOSE port
Example 2 | Use a linux base image:
FROM ubuntu RUN apt-get install npm RUN apt-get install nginx COPY . . RUN npm install # ... build Angular app and mv files to nginx/html
Example 3 | Build angular app outside of docker first and:
FROM nginx COPY . . # mv files to nginx/html EXPOSE port
What are the advantages / disadvantages to doing it one of these 3 ways? Are there image size differences? Does the orchestration environment (kubernetes) need access to the base images or is everything needed included when it's pushed? Which way is considered best practice?