I have this docker-compose:
version: ‘2’
services:
backend-labo:
build:
context: /Data/02-Labo/backend
dockerfile: Dockerfile
#directory: backend
ports:
- 3000:3000
restart: always
volumes:
- /Data/02-Labo/backend:/Data/02-Labo/backend
frontend-labo:
build:
context: /Data/02-Labo/frontend
dockerfile: Dockerfile
#directory: frontend
ports:
- 4200:4200
restart: always
volumes:
- /Data/02-Labo/frontend:/Data/02-Labo/frontend
The Dockerfile for the backend part:
Backend - Node.js
FROM node:18
WORKDIR /Data/02-Labo/backend
RUN apt-get update && apt-get install -y
vim
Copy backend source code
#COPY /Data/02-Labo/backend/package*.json ./
COPY package.json .
COPY package-lock.json .
#COPY package*.json ./
RUN npm install
RUN npm i ldapjs node-localstorage xlsx fs jsonwebtoken diff-arrays-of-objects
#nouveau packages V2
RUN npm i express-session
RUN npm i cors
RUN chown -R node:node /Data/02-Labo/backend
RUN npm install -g nodemon && npm install
Copy the rest of the application files
COPY . .
RUN apt-get update
#EXPOSE 3000RUN npm install pm2 -g
#RUN npm install axios
#EXPOSE 3000
Install Oracle Instant Client
WORKDIR /opt/oracle
RUN wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip &&
unzip instantclient-basiclite-linuxx64.zip && rm -f instantclient-basiclite-linuxx64.zip &&
cd /opt/oracle/instantclient* && rm -f jdbc occi mysql *README jar uidrvci genezi adrci &&
echo /opt/oracle/instantclient > /etc/ld.so.conf.d/oracle-instantclient.conf && ldconfig
WORKDIR /Data/02-Labo/backend
CMD [ “npm”, “start” ]
th Dockerfile for the frontend part:
Frontend - Angular
FROM node:18
WORKDIR /Data/02-Labo/frontend
RUN apt-get update && apt-get install -y
vim
Install Angular CLI globally
#RUN npm install -g @angular/cli
Copy frontend source code
#COPY /Data/02-Labo/frontend/package*.json ./
COPY package.json .
COPY package-lock.json .
#COPY package*.json ./
#RUN npm install
Install additional npm packages
#RUN npm i ldapjs node-localstorage xlsx fs jsonwebtoken diff-arrays-of-objects
RUN npm install -g @angular/cli
#nouveau packages V2
RUN apt-get update
RUN chown -R node:node /Data/02-Labo/frontend
#RUN npm install -g nodemon && npm install
#RUN npm install
Copy the rest of the frontend code
COPY . .
Install http-server globally
RUN npm install -g http-server
RUN apt-get update
#EXPOSE 4200
Install Oracle Instant Client
WORKDIR /opt/oracle
RUN wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip &&
unzip instantclient-basiclite-linuxx64.zip && rm -f instantclient-basiclite-linuxx64.zip &&
cd /opt/oracle/instantclient* && rm -f jdbc occi mysql *README jar uidrvci genezi adrci &&
echo /opt/oracle/instantclient > /etc/ld.so.conf.d/oracle-instantclient.conf && ldconfig
WORKDIR /Data/02-Labo/frontend
CMD [ “npm”, “start” ]
when I start the docker-compose it generate two containers one for the backend and the other for the frontend…
my problem is that the container for frontend is alays restarting…
any help please??