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

ztelur pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go-pixiu.git


The following commit(s) were added to refs/heads/develop by this push:
     new d08b4a4  add Dockerfile (#339)
d08b4a4 is described below

commit d08b4a47e1b3204092cb46999033e2a1372a8291
Author: feifeiyan <[email protected]>
AuthorDate: Sun Jan 16 20:57:54 2022 +0800

    add Dockerfile (#339)
    
    * add Dockerfile
    
    * add apache license
    
    Co-authored-by: gaoyanfei3 <[email protected]>
    Co-authored-by: Xin.Zh <[email protected]>
    Co-authored-by: randy <[email protected]>
---
 Dockerfile           | 44 ++++++++++++++++++++++++++++++++++++++++++++
 Makefile             |  8 ++++++++
 configs/log.yml      | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 docker-entrypoint.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 143 insertions(+)

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..35f76fd
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,44 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+### builder
+FROM golang:alpine as builder
+LABEL MAINTAINER="[email protected]"
+
+ENV GOPROXY="https://goproxy.cn,direct"; \
+    GO111MODULE=on \
+    CGO_ENABLED=0 \
+    GOOS=linux \
+    GOARCH=amd64
+
+RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' 
/etc/apk/repositories
+WORKDIR /app/
+COPY . .
+RUN go mod download
+RUN go build -ldflags "-s -w" -o dubbo-go-pixiu ./cmd/pixiu/*.go
+
+
+### alpine
+FROM amd64/ubuntu:latest
+COPY --from=builder /app/dubbo-go-pixiu /app/
+COPY --from=builder /app/docker-entrypoint.sh /app/
+COPY --from=builder /app/configs/* /etc/pixiu/
+WORKDIR /app/
+RUN ["chmod", "+x","./docker-entrypoint.sh"]
+ENTRYPOINT ["./docker-entrypoint.sh"]
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 6e997fd..75a2109 100644
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,7 @@ cur_mkfile := $(abspath $(lastword $(MAKEFILE_LIST)))
 currentPath := $(patsubst %/, %, $(dir $(cur_mkfile)))
 pixiuPath := /cmd/pixiu/
 mainPath := $(currentPath)$(pixiuPath)
+VERSION = $(shell git describe --abbrev=0  --tags $(git rev-list --tags 
--max-count=1) || echo "0.0.4")
 
 targetName := dubbo-go-pixiu
 
@@ -56,6 +57,13 @@ license-check-util:
 license-check:
        license-header-checker -v -a -r -i vendor -i .github/actions 
/tmp/tools/license/license.txt . go
 
+image:
+       @docker build \
+               -t apache/$(targetName):latest \
+               -t apache/$(targetName):$(VERSION) \
+               --build-arg build=$(BUILD) --build-arg version=$(VERSION) \
+               -f Dockerfile --no-cache .
+
 test:
        sh before_ut.sh
        go test ./pkg/... -coverprofile=coverage.txt -covermode=atomic
diff --git a/configs/log.yml b/configs/log.yml
new file mode 100644
index 0000000..327f937
--- /dev/null
+++ b/configs/log.yml
@@ -0,0 +1,46 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+level: "debug"
+development: true
+disableCaller: false
+disableStacktrace: false
+sampling:
+encoding: "console"
+
+# encoder
+encoderConfig:
+  messageKey: "message"
+  levelKey: "level"
+  timeKey: "time"
+  nameKey: "logger"
+  callerKey: "caller"
+  stacktraceKey: "stacktrace"
+  lineEnding: ""
+  levelEncoder: "capitalColor"
+  timeEncoder: "iso8601"
+  durationEncoder: "seconds"
+  callerEncoder: "short"
+  nameEncoder: ""
+
+outputPaths:
+  - "stderr"
+errorOutputPaths:
+  - "stderr"
+initialFields:
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
new file mode 100644
index 0000000..dea38a1
--- /dev/null
+++ b/docker-entrypoint.sh
@@ -0,0 +1,45 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+CMD_PARAMS=""
+API_CONF="api_config.yaml"
+LOG="log.yml"
+CONF="conf.yaml"
+
+cd /etc/pixiu/ &&  ls -al /etc/pixiu/
+echo "current path: $(pwd)"
+
+if [ ! -f "$CONF" ]; then
+    echo "error: $CONF not exists!"
+    exit
+fi
+CMD_PARAMS="-c /etc/pixiu/${CONF}"
+
+if [ -f "$API_CONF" ]; then
+    CMD_PARAMS="$CMD_PARAMS -a /etc/pixiu/${API_CONF}"
+fi
+
+if [ -f "$LOG" ]; then
+    CMD_PARAMS="$CMD_PARAMS -g /etc/pixiu/${LOG}"
+fi
+
+cd /app/ && ls -al .
+echo "current path: $(pwd)"
+echo "CMD_PARAMS: $CMD_PARAMS"
+./dubbo-go-pixiu gateway start $CMD_PARAMS

Reply via email to