From 08d4161cad90aa8a657e480a1181059f457bcd8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A5=E5=91=98=E5=91=98?= <7852974+xu_member@user.noreply.gitee.com> Date: Tue, 15 Nov 2022 16:59:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20Dockerfile=20run.s?= =?UTF-8?q?h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 5 +++++ run.sh | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 Dockerfile create mode 100644 run.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4d85bbd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM openjdk:8 +VOLUME /tmp +ADD scenic-1.0-SNAPSHOT.jar app.jar +EXPOSE 8081 +ENTRYPOINT ["java","-jar","app.jar"] \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..37f23f4 --- /dev/null +++ b/run.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# 定义应用组名 +group_name='xyy' +# 定义应用名称 +app_name='init' +# 定义应用版本 +app_version='latest' +# 定义应用环境 +profile_active='dev' +echo '----copy jar----' +docker stop ${app_name} +echo '----stop container----' +docker rm ${app_name} +echo '----rm container----' +docker rmi ${group_name}/${app_name}:${app_version} +echo '----rm image----' +# 打包编译docker镜像 +docker build -t ${group_name}/${app_name}:${app_version} . +echo '----build image----' +docker run -p 0504:8081 --name ${app_name} \ +-e TZ="Asia/Shanghai" \ +-v /etc/localtime:/etc/localtime \ +-d ${group_name}/${app_name}:${app_version} +echo '----start container----' \ No newline at end of file