This is an automated email from the ASF dual-hosted git repository. shuyangw pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-docker.git
The following commit(s) were added to refs/heads/master by this push: new 47122bf docs: Replace `docker build` command with `make` (#161) 47122bf is described below commit 47122bf141cc08cf22a44fbafab15b67d45c0c77 Author: Ayush das <ayush24...@gmail.com> AuthorDate: Mon Apr 19 08:37:41 2021 +0530 docs: Replace `docker build` command with `make` (#161) --- Makefile | 8 ++++++++ README.md | 34 +++++++++++++++++++++++----------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 9294026..90701bd 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,14 @@ push-on-centos: push-on-alpine: docker push $(IMAGE_NAME):$(APISIX_VERSION)-alpine +### build-on-alpine-cn: Build apache/apisix:xx-alpine image (for chinese) +build-on-alpine-cn: + docker build -t $(IMAGE_NAME):${APISIX_VERSION}-alpine --build-arg APISIX_VERSION=${APISIX_VERSION} --build-arg ENABLE_PROXY=true -f alpine/Dockerfile alpine + +### build-all-in-one: Build All in one Docker container for Apache APISIX +build-all-in-one: + docker build -t $(IMAGE_NAME):whole -f ./all-in-one/apisix/Dockerfile . + ### save-centos-tar: tar apache/apisix:xx-centos image save-centos-tar: mkdir -p package diff --git a/README.md b/README.md index 374c7cc..2044311 100644 --- a/README.md +++ b/README.md @@ -7,31 +7,43 @@ ### Build an image from source 1. Build from release version: -``` +```sh # Assign Apache release version number to variable `APISIX_VERSION`, for example: 2.4. The latest version can be find at `https://github.com/apache/apisix/releases` export APISIX_VERSION=2.4 -docker build -t apisix:${APISIX_VERSION}-alpine --build-arg APISIX_VERSION=${APISIX_VERSION} -f alpine/Dockerfile alpine +# alpine +$ make build-on-alpine + +# centos +$ make build-on-centos ``` 2. Build from master branch version, which has latest code(ONLY for the developer's convenience): -``` +```sh export APISIX_VERSION=master -docker build -t apisix:${APISIX_VERSION}-alpine --build-arg APISIX_VERSION=${APISIX_VERSION} -f alpine/Dockerfile alpine +# alpine +$ make build-on-alpine + +# centos +$ make build-on-centos ``` 3. Build from local code: -``` +```sh # To copy apisix into image, we need to include it in build context -cd <APISIX-PATH> -docker build -t apisix:alpine-local --build-arg APISIX_PATH=. -f <APISIX-DOCKER-PATH>/alpine-local/Dockerfile alpine +$ cd <APISIX-PATH> + +# alpine + +$ APISIX_PATH=/path/to/apisix make build-on-alpine-local + # Might need root privilege if encounter "error checking context: 'can't stat'" ``` **Note:** For Chinese, the following command is always recommended. The additional build argument `ENABLE_PROXY=true` will enable proxy to definitely accelerate the progress. ```sh -$ docker build -t apisix:${APISIX_VERSION}-alpine --build-arg APISIX_VERSION=${APISIX_VERSION} --build-arg ENABLE_PROXY=true -f alpine/Dockerfile alpine +$ make build-on-alpine-cn ``` ### Manual deploy apisix via docker @@ -42,7 +54,7 @@ $ docker build -t apisix:${APISIX_VERSION}-alpine --build-arg APISIX_VERSION=${A **start all modules with docker-compose** -``` +```sh $ cd example $ docker-compose -p docker-apisix up -d ``` @@ -54,7 +66,7 @@ You can refer to [the docker-compose example](docs/en/latest/example.md) for mor * All in one Docker container for Apache APISIX ```shell -$ docker build -t apache/apisix:whole -f ./all-in-one/apisix/Dockerfile . +$ make build-all-in-one $ docker run -v `pwd`/all-in-one/apisix/config.yaml:/usr/local/apisix/conf/config.yaml -p 9080:9080 -p 2379:2379 -d apache/apisix:whole ``` @@ -63,7 +75,7 @@ $ docker run -v `pwd`/all-in-one/apisix/config.yaml:/usr/local/apisix/conf/confi **The latest version of `apisix-dashboard` is 2.4 and should be used with APISIX 2.3.** ```shell -$ docker build --build-arg APISIX_VERSION=2.3 --build-arg APISIX_DASHBOARD_VERSION=v2.4 -t apache/apisix-dashboard:whole -f ./all-in-one/apisix-dashboard/Dockerfile . +$ make build-dashboard $ docker run -v `pwd`/all-in-one/apisix/config.yaml:/usr/local/apisix/conf/config.yaml -v `pwd`/all-in-one/apisix-dashboard/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml -p 9080:9080 -p 2379:2379 -p 9000:9000 -d apache/apisix-dashboard:whole ```