You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by kv...@apache.org on 2021/05/26 09:39:07 UTC

[apisix-docker] branch master updated: fix: add forward error to log for local build (#176)

This is an automated email from the ASF dual-hosted git repository.

kvn 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 d397aca  fix: add forward error to log for local build (#176)
d397aca is described below

commit d397acaf06d585796e26e972e447764a8c286fef
Author: Shuyang Wu <wo...@gmail.com>
AuthorDate: Wed May 26 05:38:57 2021 -0400

    fix: add forward error to log for local build (#176)
    
    Signed-off-by: yiyiyimu <wo...@gmail.com>
---
 README.md               | 7 ++-----
 alpine-dev/Dockerfile   | 4 ++++
 alpine-local/Dockerfile | 5 +++++
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index 2044311..9e23c6c 100644
--- a/README.md
+++ b/README.md
@@ -31,11 +31,8 @@ $ 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>
-
-# alpine
-
-$ APISIX_PATH=/path/to/apisix make build-on-alpine-local
+$ cp -r <APISIX-PATH> ./apisix
+$ APISIX_PATH=./apisix make build-on-alpine-local
 
 # Might need root privilege if encounter "error checking context: 'can't stat'"
 ```
diff --git a/alpine-dev/Dockerfile b/alpine-dev/Dockerfile
index 0054eeb..650ee71 100644
--- a/alpine-dev/Dockerfile
+++ b/alpine-dev/Dockerfile
@@ -34,6 +34,10 @@ COPY --from=production-stage /usr/local/openresty/ /usr/local/openresty/
 COPY --from=production-stage /usr/local/apisix/ /usr/local/apisix/
 COPY --from=production-stage /usr/bin/apisix /usr/bin/apisix
 
+# forward request and error logs to docker log collector
+RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \
+    && ln -sf /dev/stderr /usr/local/apisix/logs/error.log
+
 ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
 
 EXPOSE 9080 9443
diff --git a/alpine-local/Dockerfile b/alpine-local/Dockerfile
index e0f5e56..2001186 100644
--- a/alpine-local/Dockerfile
+++ b/alpine-local/Dockerfile
@@ -34,6 +34,11 @@ COPY --from=production-stage /usr/local/openresty/ /usr/local/openresty/
 COPY --from=production-stage /usr/local/apisix/ /usr/local/apisix/
 COPY --from=production-stage /usr/bin/apisix /usr/bin/apisix
 
+# forward request and error logs to docker log collector
+RUN mkdir -p logs && touch logs/access.log && touch logs/error.log \
+    && ln -sf /dev/stdout /usr/local/apisix/logs/access.log \
+    && ln -sf /dev/stderr /usr/local/apisix/logs/error.log
+
 ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
 
 EXPOSE 9080 9443