From 58d42dc382d4ebd42cf85d1ade83f5437210fc95 Mon Sep 17 00:00:00 2001 From: tanghc Date: Tue, 20 Oct 2020 10:58:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81docker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-build.sh | 10 +++++++++- dockerfile | 12 +++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docker-build.sh b/docker-build.sh index f4d43e59..de4d00f7 100644 --- a/docker-build.sh +++ b/docker-build.sh @@ -1,4 +1,12 @@ #!/bin/bash +# 打包 mvn clean package -docker build -t sop . +# 创建镜像 +docker build -t gitee.com/sop . + +# 获取镜像id +image_id=`docker images gitee.com/sop --format "{{.ID}}" | awk '{print $1}'` + +# 运行镜像 +docker run --name sop -p 8081:8081 -p 8082:8082 -p 8083:8083 -p 2222:2222 -d $image_id \ No newline at end of file diff --git a/dockerfile b/dockerfile index f628b286..de813168 100644 --- a/dockerfile +++ b/dockerfile @@ -5,6 +5,7 @@ VOLUME /sop ADD sop-gateway/target/*.jar sop/sop-gateway/sop-gateway.jar ADD sop-admin/sop-admin-server/target/*.jar sop/sop-admin/sop-admin.jar ADD sop-website/target/*.jar sop/sop-website/sop-website.jar +ADD sop-auth/target/*.jar sop/sop-website/sop-auth.jar ADD sop-example/sop-story/target/*.jar sop/sop-story/sop-story.jar @@ -15,9 +16,10 @@ ENV JAVA_OPTS="-Xms128m -Xmx128m" # --logging.file:日志 # --mysql.host:mysql地址 # --register.url:nacos地址 -ENV CONF="--logging.file=log/spring.log --mysql.host=10.1.30.120:3306 --register.url=10.1.30.110:8848" +ENV CONF="--logging.file.path=log --mysql.host=10.1.30.120:3306 --register.url=10.1.30.110:8848" -ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-gateway.jar ${CONF} -ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-admin.jar ${CONF} -ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-website.jar ${CONF} -ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-story.jar ${CONF} +ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-gateway/sop-gateway.jar ${CONF} +ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-admin/sop-admin.jar ${CONF} +ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-website/sop-website.jar ${CONF} +ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-auth/sop-auth.jar ${CONF} +ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-story/sop-story.jar ${CONF}