FROM python:3.5 AS python-build
ADD . /test
WORKDIR /test
RUN pip install -r requirements.txt &&\
pip install oauth2client
FROM node:10-alpine AS node-build
WORKDIR /test
COPY --from=python-build ./test ./
WORKDIR /test/app/static
RUN npm cache verify && npm install && npm install sass -g &&\
sass --no-source-map scss/layout/_header.scss:css/layout/_header.css &&\
sass --no-source-map scss/layout/_footer.scss:css/layout/_footer.css &&\
sass --no-source-map scss/layout/_side_menu.scss:css/layout/_side_menu.css &&\
sass --no-source-map scss/layout/_error_component.scss:css/layout/_error_component.css &&\
sass --no-source-map scss/components/_input_box.scss:css/components/_input_box.css &&\
sass --no-source-map scss/components/_button.scss:css/components/_button.css &&\
sass --no-source-map scss/components/_loading_mask.scss:css/components/_loading_mask.css &&\
sass --no-source-map scss/components/_template_card.scss:css/components/_template_card.css &&\
sass --no-source-map scss/pages/_onboarding_app.scss:css/pages/_onboarding_app.css &&\
sass --no-source-map scss/pages/_choose.scss:css/pages/_choose.css &&\
sass --no-source-map scss/pages/_adapt.scss:css/pages/_adapt.css &&\
sass --no-source-map scss/pages/_express.scss:css/pages/_express.css &&\
sass --no-source-map scss/pages/_experience.scss:css/pages/_experience.css &&\
sass --no-source-map scss/pages/_features.scss:css/pages/_features.css &&\
sass --no-source-map scss/pages/_request_demo.scss:css/pages/_request_demo.css &&\
npm run build
WORKDIR /test/node-src
RUN npm install express
FROM python:3.5-slim
COPY --from=python-build /root/.cache /root/.cache
WORKDIR /test
COPY --from=node-build ./test ./
RUN apt-get update -yq \
&& apt-get install curl -yq \
&& curl -sL https://deb.nodesource.com/setup_10.x | bash \
&& pip install -r requirements.txt
WORKDIR /test/node-src
EXPOSE 3000
CMD ["node", "server.js"] #RUN NODE SERVICE INSIDE NODE/SRC
WORKDIR /test
EXPOSE 9595
CMD [ "python3", "./run.py" ] #RUN PYTHON SERVICE INSIDE /TEST
i am trying to run two service inside one container node and python but only one is running i want to run both service in one container on kubernetes.
EDIT : 1
FROM python:3.5 AS python-build
ADD . /test
WORKDIR /test
RUN pip install -r requirements.txt &&\
pip install oauth2client
FROM node:10-alpine AS node-build
WORKDIR /test
COPY --from=python-build ./test ./
WORKDIR /test/app/static
RUN npm cache verify && npm install && npm install sass -g &&\
sass --no-source-map scss/layout/_header.scss:css/layout/_header.css &&\
sass --no-source-map scss/layout/_footer.scss:css/layout/_footer.css &&\
sass --no-source-map scss/layout/_side_menu.scss:css/layout/_side_menu.css &&\
sass --no-source-map scss/layout/_error_component.scss:css/layout/_error_component.css &&\
sass --no-source-map scss/components/_input_box.scss:css/components/_input_box.css &&\
sass --no-source-map scss/components/_button.scss:css/components/_button.css &&\
sass --no-source-map scss/components/_loading_mask.scss:css/components/_loading_mask.css &&\
sass --no-source-map scss/components/_template_card.scss:css/components/_template_card.css &&\
sass --no-source-map scss/pages/_onboarding_app.scss:css/pages/_onboarding_app.css &&\
sass --no-source-map scss/pages/_choose.scss:css/pages/_choose.css &&\
sass --no-source-map scss/pages/_adapt.scss:css/pages/_adapt.css &&\
sass --no-source-map scss/pages/_express.scss:css/pages/_express.css &&\
sass --no-source-map scss/pages/_experience.scss:css/pages/_experience.css &&\
sass --no-source-map scss/pages/_features.scss:css/pages/_features.css &&\
sass --no-source-map scss/pages/_request_demo.scss:css/pages/_request_demo.css &&\
npm run build
WORKDIR /test/node-src
RUN npm install express
FROM python:3.5-slim
COPY --from=python-build /root/.cache /root/.cache
WORKDIR /test
COPY --from=node-build ./test ./
RUN apt-get update -yq \
&& apt-get install curl -yq \
&& curl -sL https://deb.nodesource.com/setup_10.x | bash \
&& pip install -r requirements.txt
WORKDIR /test/node-src
RUN npm install pm2 -g
EXPOSE 3000
CMD pm2 start server.js #RUN NODE SERVICE INSIDE NODE/SRC
WORKDIR /test
EXPOSE 9595
CMD [ "python3", "./run.py" ] #RUN PYTHON SERVICE INSIDE /TEST
i also tried pm2 service for node.
what you are trying to achieve it is not a recommended design. typically a docker container should run a single service. as a result, there is no built-in way in docker to get this to work, although it is still possible, using a wrapper script or tools like supervisord, you can manage multiple services inside the container-
or as for the docs: (i went for the supervisord option since to me it looks more clean and manageable than the wrapper script way)
Use a process manager like supervisord. This is a moderately heavy-weight approach that requires you to package supervisord and its configuration in your image (or base your image on one that includes supervisord), along with the different applications it manages. Then you start supervisord, which manages your processes for you. Here is an example Dockerfile using this approach, that assumes the pre-written supervisord.conf, my_first_process, and my_second_process files all exist in the same directory as your Dockerfile.
FROM ubuntu:latest RUN apt-get update && apt-get install -y supervisor RUN mkdir -p /var/log/supervisor COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY my_first_process my_first_process COPY my_second_process my_second_process CMD ["/usr/bin/supervisord"]
https://docs.docker.com/config/containers/multi-service_container/
what you are currently using in your Dockerfile is called multisage build which is by far not what you really want.