From 0c43f28cdc558fea16191879534cbc071f437083 Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Wed, 15 Apr 2020 01:02:39 +0300 Subject: [PATCH] start multiple processes in same container --- Dockerfile | 2 +- start/image+container.txt | 5 +++++ start/start.sh | 4 ++-- webpack.config.prod.js | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 start/image+container.txt diff --git a/Dockerfile b/Dockerfile index 7d385b4..89d98d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ RUN npm install json-server --save-prod WORKDIR /application -EXPOSE 80 +EXPOSE 80 3001 CMD ["./start.sh"] #CMD ["sh", "-c", "node application/api/createMockDb.js && node application/api/apiServer.js && serve -s application/front -p 80"] diff --git a/start/image+container.txt b/start/image+container.txt new file mode 100644 index 0000000..756c87f --- /dev/null +++ b/start/image+container.txt @@ -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 \ No newline at end of file diff --git a/start/start.sh b/start/start.sh index d457fd8..98918ff 100644 --- a/start/start.sh +++ b/start/start.sh @@ -1,7 +1,7 @@ #!/bin/bash -# Start the first process -./front/front.sh -D +# Start the first process and put it in the background +./front/front.sh -D & status=$? if [ $status -ne 0 ]; then echo "Failed to start front: $status" diff --git a/webpack.config.prod.js b/webpack.config.prod.js index 354a83c..6cf4613 100644 --- a/webpack.config.prod.js +++ b/webpack.config.prod.js @@ -27,7 +27,7 @@ module.exports = { new webpack.DefinePlugin({ // This global makes sure React is built in prod mode. "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({ template: "src/index.html",