[
https://issues.apache.org/jira/browse/SCB-779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16561473#comment-16561473
]
ASF GitHub Bot commented on SCB-779:
------------------------------------
asifdxtreme commented on a change in pull request #402: SCB-779 Add docker
builder pattern scripts
URL:
https://github.com/apache/incubator-servicecomb-service-center/pull/402#discussion_r206027326
##########
File path: scripts/docker/build-frontend-image/build.sh
##########
@@ -20,37 +20,45 @@ set -e
umask 027
SCRIPT_DIR=$(cd $(dirname $0); pwd)
-BASE_DIR=${SCRIPT_DIR}/../../..
-mkdir -p $SCRIPT_DIR/frontend
-
-cd $BASE_DIR/frontend
+BASE_DIR=${SCRIPT_DIR}/../../../
-# make CGO_ENABLED=0 since busybox will not execute if it is dynamically linked
-export CGO_ENABLED=0
-export GOOS="linux"
-export GOARCH="amd64"
+# build all
+PACKAGE=${1:-"latest"}
-# buils scfrontend
-go build -o $SCRIPT_DIR/frontend/scfrontend
+PACKAGE_PREFIX=apache-servicecomb-incubating-service-center
-#go to the script directory
-#cd $SCRIPT_DIR
+PACKAGE_DIR=$SCRIPT_DIR/../$PACKAGE_PREFIX-$PACKAGE-linux-amd64
-# copy the app conf folders to build-frontend-image/frontend
-cp -r app conf $BASE_DIR/scripts/frontend/start_linux.sh $SCRIPT_DIR/frontend
+source ${SCRIPT_DIR}/../../build/tools.sh
-chmod 755 $SCRIPT_DIR/frontend/start_linux.sh $SCRIPT_DIR/frontend/scfrontend
+if [ ! -d $PACKAGE_DIR ]; then
+ docker_builder_pattern $BASE_DIR $SCRIPT_DIR/../
+fi
-sed -i "s|frontend_host_ip=127.0.0.1|frontend_host_ip=0.0.0.0|g"
$SCRIPT_DIR/frontend/conf/app.conf
+# create image base dir
+mkdir -p $SCRIPT_DIR/frontend
-#go to the script directory
+# go to the script directory
cd $SCRIPT_DIR
-tar cf frontend.tar.gz frontend
+
+# copy the conf folder to build-frontend-image/frontend
+cp -rp $PACKAGE_DIR/app $PACKAGE_DIR/conf $PACKAGE_DIR/frontend start.sh
frontend
+
+chmod 500 frontend/start.sh frontend/frontend
+
+# store the base image name and version
+BASE_IMAGE=${BASE_IMAGE:-"ubuntu"}
+
+BASE_IMAGE_VERSION=${BASE_IMAGE_VERSION:-"latest"}
+
cp Dockerfile.tmpl Dockerfile
-docker build -t servicecomb/scfrontend .
-docker save servicecomb/scfrontend:latest |gzip >scfrontend-dev.tgz
+sed -i "s|{{.BASE_IMAGE}}|${BASE_IMAGE}|g" Dockerfile
+sed -i "s|{{.BASE_IMAGE_VERSION}}|${BASE_IMAGE_VERSION}|g" Dockerfile
+
+docker build --no-cache -t servicecomb/scfrontend:$PACKAGE .
+docker save servicecomb/scfrontend:$PACKAGE |gzip >scfrontend-dev.tgz
Review comment:
can we put the frontend and service-center in the same image instead of
having 2 images
If both are in same image then it will be easy to communicate between both
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Add docker builder pattern scripts
> ----------------------------------
>
> Key: SCB-779
> URL: https://issues.apache.org/jira/browse/SCB-779
> Project: Apache ServiceComb
> Issue Type: Improvement
> Components: Service-Center
> Reporter: little-cui
> Assignee: little-cui
> Priority: Major
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)