共计 728 个字符,预计需要花费 2 分钟才能阅读完成。
dockerfile 内容:
# 根底镜像
FROM openjdk:8-jre
# author
MAINTAINER lw
# 挂载目录
VOLUME /home/ybss
# 创立目录
RUN mkdir -p /home/ybss
# 指定门路
WORKDIR /home/ybss
ADD ./jar/lib /home/ybss/lib
ADD ./jar/*.yml /home/ybss/
# 复制 jar 文件到门路
COPY ./jar/run.jar /home/ybss/run.jar
# 启动认证服务
ENTRYPOINT ["java","-jar","-Dserver.port=9200","-Dspring.profiles.active=dev","run.jar"]
docker-compose.yml 内容:
version : '3.8'
services:
ybss-auth:
container_name: ybss-auth
build:
context: ./ybss/auth
dockerfile: dockerfile
ports:
- "19200:9200"
volumes:
- /home/ybss/ybss/auth/jar:/home/ybss
networks:
ybss_default:
driver: bridge
volumes 挂载目录 /home/ybss/ybss/auth/jar,有更新时,只须要把更新 jar 和文件替换即可。
部署脚本 shell:
#!/bin/sh
auth(){
chmod 777 -R ./ybss/auth/*
docker-compose up -d ybss-auth
}
stop(){docker-compose stop}
case "$1" in
"auth")
auth
;;
"s")
stop
;;
正文完
发表至: springboot
2022-09-07