Compare commits

...

2 Commits

Author SHA1 Message Date
胥员员
08d4161cad feat: 添加 Dockerfile run.sh
Some checks failed
continuous-integration/drone/push Build is failing
2022-11-15 16:59:58 +08:00
c85e76cc26 更新 '.drone.yml'
Some checks failed
continuous-integration/drone/push Build is failing
2022-11-15 16:29:30 +08:00
3 changed files with 30 additions and 1 deletions

View File

@ -3,7 +3,7 @@ type: docker
name: jar-deploy name: jar-deploy
trigger: trigger:
event: [ push ] event: [ push ]
branch: [ main ] branch: [ master ]
steps: steps:
- name: build-package - name: build-package
image: maven:3.8-openjdk-8 image: maven:3.8-openjdk-8

5
Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM openjdk:8
VOLUME /tmp
ADD scenic-1.0-SNAPSHOT.jar app.jar
EXPOSE 8081
ENTRYPOINT ["java","-jar","app.jar"]

24
run.sh Normal file
View File

@ -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----'