From cfe0e1f16969069be7bf4eaf51e8c728754f88cc Mon Sep 17 00:00:00 2001 From: cyw0ng Date: Thu, 18 Jun 2020 18:07:03 +0000 Subject: [PATCH 1/2] [optimize] improve Dockerfile quality Improve Dockerfile quality according to official guides[1]. 1. group all ENV declarations to the very start; 2. optimize apt-get usage to meet official recommendation; 3. add base image tag to meet official recommendation. [1] https://docs.docker.com/develop/develop-images/dockerfile_best-practices Signed-off-by: cyw0ng --- Dockerfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index c2012b245..589aa2191 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,14 @@ -FROM nginx +FROM nginx:latest MAINTAINER Edward Lee -RUN apt-get update && \ - apt install curl -y && \ - apt-get install git -y - ENV HUGO_VERSION=0.68.1 +ENV RUN_USER nginx +ENV RUN_GROUP nginx + +RUN apt-get update && apt-get install -y \ + git curl && \ + rm -rf /var/lib/apt/lists/* RUN mkdir -p /usr/local/src && \ cd /usr/local/src && \ @@ -18,7 +20,5 @@ RUN cd /src/ && /usr/local/bin/hugo -b / && \ cp -rf /src/public/* /usr/share/nginx/html/ && \ chmod -R 755 /usr/share/nginx/html -ENV RUN_USER nginx -ENV RUN_GROUP nginx EXPOSE 80 ENTRYPOINT nginx -g "daemon off;" -- Gitee From acadca7187053d338c87327d265de32ecc1410ab Mon Sep 17 00:00:00 2001 From: cyw0ng Date: Thu, 18 Jun 2020 18:15:34 +0000 Subject: [PATCH 2/2] [optimize] improve & fix some typo mistakes Signed-off-by: cyw0ng --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 25e77c9a1..087c562ac 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ you are welcome to join us. ### Installation -1. Build Image +1. Build an image ``` docker build -t docs:v0.0.1 . @@ -23,18 +23,19 @@ note: here ```docs``` is the image name, you can change it as you need. > > `--build-arg` can be specified many times, like `http_proxy`, `https_proxy`, `HTTP_PROXY`, `HTTPS_PROXY` and so on. -2. Running in container +2. Run a container ``` -docker run -p 80:80 -d docs:v0.0.1 > docs.pid +# YOUR_PORT could be 80 or any other free port on host system +docker run -p ${YOUR_PORT}:80 -d docs:v0.0.1 > docs.pid ``` -The website will serving on http://your-server-ip:80 +The website will serving on http://your-server-ip:${YOUR_PORT} The defalut language(en) will serving on http://your-server-ip/ Other language(zh) will serving on http://your-server-ip/zh -3. Stopping the container +3. Stop the container ``` docker rm -f `cat docs.pid` && rm -f docs.pid -- Gitee