Skip to content

Commit

Permalink
add docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jul 5, 2019
1 parent b9288b8 commit 05ed0fc
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:8

RUN apt-get update && apt-get install -y net-tools vim telnet

LABEL gateway.version=$VERSION
LABEL gateway.build_date=$BUILD_DATE

WORKDIR /usr/src/app

ADD . .
RUN npm install

EXPOSE 3039

CMD npm run start
30 changes: 30 additions & 0 deletions buildimage-config-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
###################################################################
#Script Name : buildimage-configSvr.sh
#Description : 用于给config server生成docker镜像,生成镜像后,可以手动执行下面一条指令启动容器
#Start container: docker run -d --name gateway -p 8081:8081 -p 8182:8182 -v /data/logs-gateway:/usr/src/app/log -v /opt/gateway/backend/config:/usr/src/app/config --link postgres:postgres 121.196.217.176:5000/gateway/gateway-backend:rc-1.0
#Args : BUILD_DATE - build date
# VERSION - gateway version info
#Author : invan
#Email : [email protected]
###################################################################

VERSION_FILE='package.json'
VERSION=V$(jq -r '.version' $VERSION_FILE)
echo -e "start to build image cybex-config-server:${VERSION}"

echo -e "1 remove exist image and container"
docker stop cybex-config-server
docker rm cybex-config-server
docker rmi cybex-config-server:${VERSION}

echo -e "2 build executable files"
echo `pwd`
git pull

echo -e "3 build docker image"
docker build --force-rm --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg VERSION=$VERSION -t cybex-config-server:$VERSION -f ./Dockerfile .

echo -e "---------------------------"
echo -e "build cybex-config-server success"
echo -e "---------------------------"

0 comments on commit 05ed0fc

Please sign in to comment.