Another start script to run multiple processes in the same docker container
parent
0c43f28cdc
commit
7f86c057f9
|
@ -24,8 +24,8 @@ COPY --from=builder /app/start/api.sh ./application/api/
|
||||||
RUN chmod +x application/api/api.sh
|
RUN chmod +x application/api/api.sh
|
||||||
|
|
||||||
RUN printf '\n\n- Copy application starting script\n'
|
RUN printf '\n\n- Copy application starting script\n'
|
||||||
COPY --from=builder /app/start/start.sh ./application/
|
COPY --from=builder /app/start/start2.sh ./application/
|
||||||
RUN chmod +x application/start.sh
|
RUN chmod +x application/start2.sh
|
||||||
|
|
||||||
#install static server || Alternativ se poate utiliza si http-server
|
#install static server || Alternativ se poate utiliza si http-server
|
||||||
RUN npm install -g serve
|
RUN npm install -g serve
|
||||||
|
@ -38,7 +38,7 @@ WORKDIR /application
|
||||||
|
|
||||||
EXPOSE 80 3001
|
EXPOSE 80 3001
|
||||||
|
|
||||||
CMD ["./start.sh"]
|
CMD ["./start2.sh"]
|
||||||
#CMD ["sh", "-c", "node application/api/createMockDb.js && node application/api/apiServer.js && serve -s application/front -p 80"]
|
#CMD ["sh", "-c", "node application/api/createMockDb.js && node application/api/apiServer.js && serve -s application/front -p 80"]
|
||||||
#CMD ["serve", "-s", "build", "-p", "80"]
|
#CMD ["serve", "-s", "build", "-p", "80"]
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Start the first process and put it in the background
|
# Start the first process and put it in the background
|
||||||
./front/front.sh -D &
|
./api/api.sh -D &
|
||||||
status=$?
|
status=$?
|
||||||
if [ $status -ne 0 ]; then
|
if [ $status -ne 0 ]; then
|
||||||
echo "Failed to start front: $status"
|
echo "Failed to start api: $status"
|
||||||
exit $status
|
exit $status
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start the second process
|
# Start the second process
|
||||||
./api/api.sh -D
|
./front/front.sh -D
|
||||||
status=$?
|
status=$?
|
||||||
if [ $status -ne 0 ]; then
|
if [ $status -ne 0 ]; then
|
||||||
echo "Failed to start api: $status"
|
echo "Failed to start front: $status"
|
||||||
exit $status
|
exit $status
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# turn on bash's job control
|
||||||
|
set -m
|
||||||
|
|
||||||
|
# Start the primary process and put it in the background
|
||||||
|
./front/front.sh &
|
||||||
|
|
||||||
|
|
||||||
|
# Start the helper process
|
||||||
|
./api/api.sh
|
||||||
|
|
||||||
|
# the my_helper_process might need to know how to wait on the
|
||||||
|
# primary process to start before it does its work and returns
|
||||||
|
|
||||||
|
# now we bring the primary process back into the foreground
|
||||||
|
# and leave it there
|
||||||
|
fg %1
|
Loading…
Reference in New Issue