Dockerfile
bash
FROM openjdk:8u212-jre
MAINTAINER weimingzhong 1017291024@qq.com
COPY ./common-gateway.jar /common-gateway.jar
ENTRYPOINT ["java", "-jar", "/common-gateway.jar"]
build.sh
bash
#/bin/sh
cd /software/oauth_server/backend/common-platform
sudo docker rm -f common-platform
sudo docker rmi common-platform
sudo docker build -t common-platform .
cd /software/oauth_server/backend/common-user
sudo docker rm -f common-user
sudo docker rmi common-user
sudo docker build -t common-user .
cd /software/oauth_server/backend/common-gateway
sudo docker rm -f common-gateway
sudo docker rmi common-gateway
sudo docker build -t common-gateway .
cd /software/oauth_server/backend/common-sso
sudo docker rm -f common-sso
sudo docker rmi common-sso
sudo docker build -t common-sso .
docker-compose.yml
bash
version: "3"
services:
common-gateway:
# 指定容器名称
container_name: common-gateway
# 重启机制
restart: always
image: common-gateway
volumes:
# 挂载日志 -v A:B ,A指宿主机位置,B指容器位置
- ./logs:/logs
# 指定容器时间为宿主机时间
- /etc/localtime:/etc/localtime
# 访问端口
ports:
- "9501:9501"
environment:
# 指定时区
- TZ="Asia/Shanghai"
#启动容器后执行的命令
entrypoint: java -server -Xms1024m -Xmx1024m -jar -Dserver.port=9501 common-gateway.jar
common-sso:
# 指定容器名称
container_name: common-sso
# 重启机制
restart: always
image: common-sso
volumes:
# 挂载日志 -v A:B ,A指宿主机位置,B指容器位置
- ./logs:/logs
# 指定容器时间为宿主机时间
- /etc/localtime:/etc/localtime
# 访问端口
ports:
- "9502:9502"
environment:
# 指定时区
- TZ="Asia/Shanghai"
#启动容器后执行的命令
entrypoint: java -server -Xms1024m -Xmx1024m -jar -Dserver.port=9502 common-sso.jar
common-platform:
# 指定容器名称
container_name: common-platform
# 重启机制
restart: always
image: common-platform
volumes:
# 本地jar包路径
# - /usr/local/elemap/cloud/common-platform/target/common-platform.jar:/common-platform.jar
# 挂载日志 -v A:B ,A指宿主机位置,B指容器位置
- ./logs:/logs
# 指定容器时间为宿主机时间
- /etc/localtime:/etc/localtime
# 访问端口
ports:
- "9504:9504"
environment:
# 指定时区
- TZ="Asia/Shanghai"
#启动容器后执行的命令
entrypoint: java -server -Xms1024m -Xmx1024m -jar -Dserver.port=9504 common-platform.jar
common-user:
# 指定容器名称
container_name: common-user
# 重启机制
restart: always
image: common-user
volumes:
# 挂载日志 -v A:B ,A指宿主机位置,B指容器位置
- ./logs:/logs
# 指定容器时间为宿主机时间
- /etc/localtime:/etc/localtime
# 访问端口
ports:
- "9506:9506"
environment:
# 指定时区
- TZ="Asia/Shanghai"
#启动容器后执行的命令
entrypoint: java -server -Xms1024m -Xmx1024m -jar -Dserver.port=9506 common-user.jar
down.sh
bash
docker-compose --compatibility down
start.sh
bash
docker-compose --compatibility up -d