I have trouble dockerizing my MEAN stack application
My angular part (named storage):
FROM node:16.13.0-alpine as node
WORKDIR /usr/src/app
COPY package.json package-lock.json ./
RUN npm i -g @angular/cli
RUN npm i bootstrap
COPY . .
RUN npm run build
FROM nginx:1.18.0-alpine
COPY --from=node /usr/src/app/dist /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
My node and express and database directory named backend
FROM node:16.13.0-alpine as node
WORKDIR /usr/src/app
COPY package.json package-lock.json ./
RUN npm i -g @angular/cli
RUN npm i bootstrap
COPY . .
RUN npm run build
FROM nginx:1.18.0-alpine
COPY --from=node /usr/src/app/dist /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
And my docker-compose.yml file
version: '3'
services:
angular:
hostname: localhost
build: storage
ports:
- "4200:80"
express:
build: backend
ports:
- "4000:4000"
links:
- database
database:
image: mongo
ports:
- "27017:27017"
I would be very happy if you can check and my code if I am missing something because I making docker-image for the first time..