start multiple processes in same container

master
Tudor Stanciu 2020-04-15 01:02:39 +03:00
parent feaf0cc0ba
commit 0c43f28cdc
4 changed files with 9 additions and 4 deletions

View File

@ -36,7 +36,7 @@ RUN npm install json-server --save-prod
WORKDIR /application WORKDIR /application
EXPOSE 80 EXPOSE 80 3001
CMD ["./start.sh"] CMD ["./start.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"]

View File

@ -0,0 +1,5 @@
docker image build -t "react-redux-course:1.0.19" .
docker run -p 5050:80 -it react-redux-course:1.0.19
Multiple ports:
docker run -p 5050:80 -p 3001:3001 -it react-redux-course:1.0.20

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Start the first process # Start the first process and put it in the background
./front/front.sh -D ./front/front.sh -D &
status=$? status=$?
if [ $status -ne 0 ]; then if [ $status -ne 0 ]; then
echo "Failed to start front: $status" echo "Failed to start front: $status"

View File

@ -27,7 +27,7 @@ module.exports = {
new webpack.DefinePlugin({ new webpack.DefinePlugin({
// This global makes sure React is built in prod mode. // This global makes sure React is built in prod mode.
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV), "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
"process.env.API_URL": JSON.stringify("http://localhost:3001") "process.env.API_URL": JSON.stringify("http://127.0.0.1:3001")
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: "src/index.html", template: "src/index.html",