I am trying to create a Cocker container for my Angular that has a PHP file in it. Angular requires npm so I need to have Node.js installed. I don\'t need Apache for my proj
I think in this case the better way is using node docker image and PHP docker image together like bellow and not installing one of them by using apt-get install
FROM node:latest AS node
FROM php:7.4-fpm
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node /usr/local/bin/node /usr/local/bin/node
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app
RUN npm install
COPY . /usr/src/app
in this way you don't need to install either node or PHP package every time that you change your code and rebuild from scratch is required in your Dockerfile