From 0ab06617f457b74b9e53f2671e2e17fff96d2bfa Mon Sep 17 00:00:00 2001 From: francozacco Date: Thu, 11 Jun 2020 16:59:01 -0300 Subject: [PATCH 1/3] dockerizing --- docker/Dockerfile | 7 +++++++ docker/run_docker.sh | 23 +++++++++++++++++++++++ docs/guide.md | 15 ++++++++++++++- 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 docker/Dockerfile create mode 100644 docker/run_docker.sh diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..801c8e9 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,7 @@ +FROM node:12-alpine + +COPY . /src +WORKDIR /src +RUN npm install -g live-server + + diff --git a/docker/run_docker.sh b/docker/run_docker.sh new file mode 100644 index 0000000..5072a52 --- /dev/null +++ b/docker/run_docker.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +docker images | grep imglab:latest + +if [ $? -ne 0 ]; then + + # Building docker image + docker build --rm -t imglab:latest -f docker/Dockerfile . + + if [ $? -ne 0 ]; then + exit 1 + fi +fi + +# Run container +docker run -it \ + -d \ + --rm \ + --name imglab \ + -p 8080:8080 \ + --memory="8g" \ + -w /src/ \ + imglab:latest live-server \ No newline at end of file diff --git a/docs/guide.md b/docs/guide.md index 689731a..8b82da9 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -100,4 +100,17 @@ To use it offline, you can either download installers or clone this repo and run 3. Run `$ live-server` in /imglab/ folder. 4. Open your browser (if it hasn't popped up already) at: `http://127.0.0.1:8080/` -*Note that* [live-server](https://www.npmjs.com/package/live-server) is just an app to run the server in easy way. You may try any other option as well. \ No newline at end of file +*Note that* [live-server](https://www.npmjs.com/package/live-server) is just an app to run the server in easy way. You may try any other option as well. + +#### Installing Dockerized version + +Assuming you installed Docker on your computer, follow the above instructions. + +From the folder where you cloned the repository (`path/imglab/`) + +1. run `$ bash docker/build_docker` and wait until the docker image is built. +2. Go to your browser and go to `http://127.0.0.1:8080/` + +#### Stopping the docker container + +Just run `docker kill imglab`, and that's it. \ No newline at end of file From b69b7f31f1de1a1ae335a0894edfa520ce9e46df Mon Sep 17 00:00:00 2001 From: francozacco Date: Thu, 11 Jun 2020 23:25:07 -0300 Subject: [PATCH 2/3] added docker image to docker-hub --- docker/Dockerfile | 2 -- docker/run_docker.sh | 16 +--------------- docs/guide.md | 2 +- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 801c8e9..6355d8c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,5 +3,3 @@ FROM node:12-alpine COPY . /src WORKDIR /src RUN npm install -g live-server - - diff --git a/docker/run_docker.sh b/docker/run_docker.sh index 5072a52..ff5ef2b 100644 --- a/docker/run_docker.sh +++ b/docker/run_docker.sh @@ -1,23 +1,9 @@ #!/bin/bash -docker images | grep imglab:latest - -if [ $? -ne 0 ]; then - - # Building docker image - docker build --rm -t imglab:latest -f docker/Dockerfile . - - if [ $? -ne 0 ]; then - exit 1 - fi -fi - -# Run container docker run -it \ -d \ --rm \ --name imglab \ -p 8080:8080 \ - --memory="8g" \ -w /src/ \ - imglab:latest live-server \ No newline at end of file + francozacco/imglab:latest live-server \ No newline at end of file diff --git a/docs/guide.md b/docs/guide.md index 8b82da9..7b56139 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -108,7 +108,7 @@ Assuming you installed Docker on your computer, follow the above instructions. From the folder where you cloned the repository (`path/imglab/`) -1. run `$ bash docker/build_docker` and wait until the docker image is built. +1. run `$ docker run -it -d --rm --name imglab -p 8080:8080 -w /src/ francozacco/imglab:latest live-server` and wait until the docker image is up and running. 2. Go to your browser and go to `http://127.0.0.1:8080/` #### Stopping the docker container From c54382f3b1963aeca9df2f660cf5d6ef27c21051 Mon Sep 17 00:00:00 2001 From: francozacco Date: Fri, 12 Jun 2020 08:19:44 -0300 Subject: [PATCH 3/3] Update guide.md --- docs/guide.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/guide.md b/docs/guide.md index 7b56139..ef2ea1c 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -104,13 +104,11 @@ To use it offline, you can either download installers or clone this repo and run #### Installing Dockerized version -Assuming you installed Docker on your computer, follow the above instructions. +Assuming you installed Docker on your computer, follow below instructions. -From the folder where you cloned the repository (`path/imglab/`) - -1. run `$ docker run -it -d --rm --name imglab -p 8080:8080 -w /src/ francozacco/imglab:latest live-server` and wait until the docker image is up and running. +1. run `$ docker run -it -d --rm --name imglab -p 8080:8080 -w /src/ francozacco/imglab:latest live-server` and wait until the docker container is up and running. 2. Go to your browser and go to `http://127.0.0.1:8080/` #### Stopping the docker container -Just run `docker kill imglab`, and that's it. \ No newline at end of file +Just run `docker kill imglab`, and that's it.